Class WireCube
For Internal Use Only. Represents a wire cube for display purposes. The edge index follows the C++ cube_node_t pattern: edgeIndex = (dir << 2) | (th1 << 1) | th0 where dir is the edge direction (0=X, 1=Y, 2=Z), th0 is the position flag in (dir+1)%3 direction, th1 is the position flag in (dir+2)%3 direction.
public class WireCube : IDisplayee, IExpandToBox3d
- Inheritance
-
WireCube
- Implements
- Inherited Members
- Extension Methods
Methods
Display(Bind)
Displays the wire cube.
public void Display(Bind bind)
Parameters
bindBindThe binding context for display.
ExpandToBox3d(ref box3d_t)
Expands the destination box to include the unit cube.
public void ExpandToBox3d(ref box3d_t dst)
Parameters
dstbox3d_tThe destination box to expand.
GetCorner(int, bool)
Gets the corner index (0-7) from an edge index and whether it's the tail endpoint. This follows the C++ WireCube::getCorner(int edgeIndex, bool is_tail) pattern.
public static int GetCorner(int edgeIndex, bool isTail)
Parameters
edgeIndexintThe edge index (0-11).
isTailboolTrue for the tail endpoint (max in edge direction), false for head (min in edge direction).
Returns
- int
The corner index (0-7) where bit 0=X, bit 1=Y, bit 2=Z indicate min(0) or max(1) position.
GetCornerVertex(box3d_t, int)
Gets the vertex position of a corner from a box.
public static vec3d_t GetCornerVertex(box3d_t box, int corner)
Parameters
boxbox3d_tThe bounding box.
cornerintThe corner index (0-7) where bit 0=X, bit 1=Y, bit 2=Z indicate min(0) or max(1) position.
Returns
- vec3d_t
The vertex position.
GetDir(int)
Gets the direction (axis) of an edge.
public static int GetDir(int edgeIndex)
Parameters
edgeIndexintThe edge index (0-11).
Returns
- int
The direction: 0=X, 1=Y, 2=Z.
GetEdgeIndex(int, int, int)
Gets the edge index from direction and position flags.
public static int GetEdgeIndex(int dir, int th0, int th1)
Parameters
dirintThe edge direction (0=X, 1=Y, 2=Z).
th0intPosition flag in (dir+1)%3 direction (0 or 1).
th1intPosition flag in (dir+2)%3 direction (0 or 1).
Returns
- int
The edge index (0-11).
GetEdgeSegment3d(box3d_t, int)
Gets the two endpoint vertices of an edge for a given box and edge index.
public static Segment3d GetEdgeSegment3d(box3d_t box, int edgeIndex)
Parameters
Returns
- Segment3d
A tuple containing the head (min in edge direction) and tail (max in edge direction) vertices of the edge.