Industrial Data Science
in C# and .NET:
Simple. Fast. Reliable.
 
 

ILNumerics - Technical Computing

Modern High Performance Tools for Technical

Computing and Visualization in Industry and Science

tgt

Clipping

Clipping is used to define regions of the scene which should be left out for rendering. The region is defined in terms of ‘half-spaces’, or ‘clipping planes’. Each clipping plane is given as a Vector4, specifying the coefficients A, B, C and D in the plane equation:

Ax + By + Cz + D = 0.

The tuple (A, B, C) is the normal of the plane (perpendicular to the plane area) and D is the distance of the plane from the origin in units of the length of the given normal.

Example: The plane defined by (1, 0, 0, 2) is a plane which is parallel to the Y-Z plane. It intersects with the X axis at -2. The normal of the plane points to the (1, 0, 0) direction, i.e.: along the X axis. If such a plane is used as clipping plane, every vertex with an X coordinate less than -2 lays ‘behind’ the plane and is discarded. Everything with an X coordinate of -2 or greater is in ‘front’ of the plane and is drawn.

The following clipping plane is used to clip a certain part from a gear. The wireframe is completely drawn. But the gear fill is partly clipped below a certain Z coordinate, i.e. below the clipping plane.

Note the definition of the clipping planes: the 4 element vector is composed out of the normal vector of the plane and the distance to the origin. The normal vector may have any length and does not need to be normalized. The normal completely defines the orientation of the plane in 3D space and is given in the first 3 components.

The distance of the plane from the origin determines the final location of the clip plane and is given in the 4th component. One may imagine the distance computed by the following algorithm:

Take the true normal vector (of length 1) and scale it by the 4th component. The resulting vector still runs along the direction of the normal vector and ends at the origin.

6 clipping planes are available at the same time. They can be combined to limit the rendering region from more than one side. One example is the Plot Cube in the Plotting API section. The cube clips its content from all 6 sides.

Clipping is a property of every group. Just like with other properties of Group, clipping is inherited by all children of the group. In cases where those children define their own coordinate system, the clipping is still applied in the coordinate system of the defining parent group.

Clipping planes are defined in the local (model) coordinate system of the group.

If a group exists under a group node which defines a clipping, it can override the inherited clipping by defining its own clipping parameters. Note that the new clip configurations are not combined with the derived ones in that case! If a group node defines its own clipping (by assigning to the Clipping property), all 6 clipping planes are activated immediately. By default, all clipping planes are configured to lay at an infinite distance away from the origin, hence do not really clip anything yet until further configuration.