Struct BoundingCube
Represents a bounding cuboid, that is an extent in 3 dimensions
Implements
Inherited Members
Namespace: CADability
Assembly: CADability.dll
Syntax
[Serializable]
public struct BoundingCube : ISerializable
Constructors
| Improve this Doc View SourceBoundingCube(GeoPoint, Double)
Constructs a equal sided BoundingCube from a center point and a "radius" (half width)
Declaration
public BoundingCube(GeoPoint center, double halfSize)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | center | Center point |
| System.Double | halfSize | Half of the width |
BoundingCube(GeoPoint[])
Constructs a BoundingCube, that encloses all given points
Declaration
public BoundingCube(params GeoPoint[] p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | p | points to enclose |
BoundingCube(Double, Double, Double, Double, Double, Double)
Constructs a BoundingCube from minimum and maximum values
Declaration
public BoundingCube(double Xmin, double Xmax, double Ymin, double Ymax, double Zmin, double Zmax)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | Xmin | Minimum in x-direction |
| System.Double | Xmax | Maximum in x-direction |
| System.Double | Ymin | Minimum in y-direction |
| System.Double | Ymax | Maximum in y-direction |
| System.Double | Zmin | Minimum in z-direction |
| System.Double | Zmax | Maximum in z-direction |
BoundingCube(SerializationInfo, StreamingContext)
Constructor required by deserialization
Declaration
public BoundingCube(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | SerializationInfo |
| System.Runtime.Serialization.StreamingContext | context | StreamingContext |
Fields
| Improve this Doc View SourceUnitBoundingCube
BoundingCube defining the interval [0,1] in all directions
Declaration
public static BoundingCube UnitBoundingCube
Field Value
| Type | Description |
|---|---|
| BoundingCube |
Xmax
Declaration
public double Xmax
Field Value
| Type | Description |
|---|---|
| System.Double |
Xmin
Declaration
public double Xmin
Field Value
| Type | Description |
|---|---|
| System.Double |
Ymax
Declaration
public double Ymax
Field Value
| Type | Description |
|---|---|
| System.Double |
Ymin
Declaration
public double Ymin
Field Value
| Type | Description |
|---|---|
| System.Double |
Zmax
Declaration
public double Zmax
Field Value
| Type | Description |
|---|---|
| System.Double |
Zmin
Declaration
public double Zmin
Field Value
| Type | Description |
|---|---|
| System.Double |
Properties
| Improve this Doc View SourceDiagonalLength
Declaration
public double DiagonalLength { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
EmptyBoundingCube
Empty BoundingCube. Defined by the special values System.Double.MinValue and System.Double.MaxValue. Often used with the MinMax(GeoPoint) or MinMax(BoundingCube) Methods.
Declaration
public static BoundingCube EmptyBoundingCube { get; }
Property Value
| Type | Description |
|---|---|
| BoundingCube |
InfiniteBoundingCube
Infinite BoundingCube. Ranging from System.Double.MinValue to System.Double.MaxValue.
Declaration
public static BoundingCube InfiniteBoundingCube { get; }
Property Value
| Type | Description |
|---|---|
| BoundingCube |
IsEmpty
Returns true if this is the special empty cube
Declaration
public bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsValid
Declaration
public bool IsValid { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
LineNumbers
Gets an array[12,2] of pairs of point indices defining the 12 edges of this cube. Indices are to the Points
Declaration
public int[, ] LineNumbers { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32[,] |
Lines
Gets the 12 edges of the cube as a GeoPoint[12, 2] array
Declaration
public GeoPoint[, ] Lines { get; }
Property Value
| Type | Description |
|---|---|
| GeoPoint[,] |
MaxSide
Gets the length of the maximum side
Declaration
public double MaxSide { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Points
Gets an array of the 8 vertices of this cube
Declaration
public GeoPoint[] Points { get; }
Property Value
| Type | Description |
|---|---|
| GeoPoint[] |
Size
Gets the sum of width, height and deepth
Declaration
public double Size { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Volume
Gets the product of width, height and deepth
Declaration
public double Volume { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
XDiff
Gets the extension in x direction
Declaration
public double XDiff { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
YDiff
Gets the extension in y direction
Declaration
public double YDiff { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
ZDiff
Gets the extension in z direction
Declaration
public double ZDiff { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Methods
| Improve this Doc View SourceClip(ICurve)
Declaration
public ICurve[] Clip(ICurve toClip)
Parameters
| Type | Name | Description |
|---|---|---|
| ICurve | toClip |
Returns
| Type | Description |
|---|---|
| ICurve[] |
ClipLine(ref GeoPoint, ref GeoPoint)
Clips the provided line (defined by start and end) by this cube.
Returns true if the line interferes with this boundingcube, modifies the start and endpoint in the parameters if clipping occures
Declaration
public bool ClipLine(ref GeoPoint start, ref GeoPoint end)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | start | Startpoint of the line, may be changed upon return |
| GeoPoint | end | Endpoint of the line, may be changed upon return |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the line and this cube interfere |
Contains(BoundingCube)
Returns true if this cube contains the provided cube. (<= will be checked)
Declaration
public bool Contains(BoundingCube extn)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingCube | extn | Cube to be checked |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Contains(GeoPoint)
Returns true if this cube contains the provided point. (<= will be checked)
Declaration
public bool Contains(GeoPoint p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | The Point |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Contains(GeoPoint, Double)
Returns true if this cube contains the provided point.
Points within the cube extended by precision
will also be accepted.
Declaration
public bool Contains(GeoPoint p, double prec)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | The Point |
| System.Double | prec |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Disjoint(BoundingCube, BoundingCube)
Returns true if the two cubes are disjoint (do not overlap and do not touch)
Declaration
public static bool Disjoint(BoundingCube b1, BoundingCube b2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingCube | b1 | First cube |
| BoundingCube | b2 | Second cube |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if disjoint |
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The System.Object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Overrides
Expand(Double)
Expands the bounding cube by the given value in all directions.
Declaration
public void Expand(double w)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | w | offset to expand with |
GetCenter()
Returns the center of this BoundingCube
Declaration
public GeoPoint GetCenter()
Returns
| Type | Description |
|---|---|
| GeoPoint |
GetExtent(Projection)
Returns the extent of the projected BoundingCube
Declaration
public BoundingRect GetExtent(Projection pr)
Parameters
| Type | Name | Description |
|---|---|---|
| Projection | pr | the projection |
Returns
| Type | Description |
|---|---|
| BoundingRect | the resulting 2-dimensional extent |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 |
Overrides
GetObjectData(SerializationInfo, StreamingContext)
Implements System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
Declaration
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | The System.Runtime.Serialization.SerializationInfo to populate with data. |
| System.Runtime.Serialization.StreamingContext | context | The destination (System.Runtime.Serialization.StreamingContext) for this serialization. |
GetPlanes()
Declaration
public PlaneSurface[] GetPlanes()
Returns
| Type | Description |
|---|---|
| PlaneSurface[] |
GetSides()
Returns 6 planar faces, the faces of this cube
Declaration
public Face[] GetSides()
Returns
| Type | Description |
|---|---|
| Face[] | the faces |
GetSolid()
Returns a solid cube as a Solid.
Declaration
public Solid GetSolid()
Returns
| Type | Description |
|---|---|
| Solid | the solid |
Interferes(BoundingCube)
Checks the interference of this cube with the other provided cube
Declaration
public bool Interferes(BoundingCube bc)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingCube | bc | the other cube to test with |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the two cubes interfere (overlap) |
Interferes(GeoPoint, GeoPoint, GeoPoint, GeoPoint)
Returns true if the provided tetrahedron (given by the four points tetra1..tetra4) and this BoundingCube interfere
Declaration
public bool Interferes(GeoPoint tetra1, GeoPoint tetra2, GeoPoint tetra3, GeoPoint tetra4)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | tetra1 | 1st tetrahedron vertex |
| GeoPoint | tetra2 | 2nd tetrahedron vertex |
| GeoPoint | tetra3 | 3rd tetrahedron vertex |
| GeoPoint | tetra4 | 4th tetrahedron vertex |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if objects interfere |
Interferes(GeoPoint, GeoVector, GeoVector, GeoVector)
Checks the interference of this cube with the provided parallelepiped (the affine projection of a cube)
Declaration
public bool Interferes(GeoPoint loc, GeoVector dirx, GeoVector diry, GeoVector dirz)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | loc | |
| GeoVector | dirx | |
| GeoVector | diry | |
| GeoVector | dirz |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Interferes(GeoPoint, GeoVector, Double, Boolean)
Returns true if the given line intersects the this bounding cube. Returns false otherwise.
Declaration
public bool Interferes(GeoPoint start, GeoVector dir, double maxdist, bool onlyForward)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | start | Startpoint of the line |
| GeoVector | dir | Direction of the line |
| System.Double | maxdist | Maximum allowable distance from the line |
| System.Boolean | onlyForward | Set to true, if only the positive ray should be cinsidered |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Interferes(ref GeoPoint, ref GeoPoint)
Returns true if the given line segment intersects the this bounding cube. Returns false otherwise.
Declaration
public bool Interferes(ref GeoPoint start, ref GeoPoint end)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | start | Start point of the line |
| GeoPoint | end | End point of the line |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if intersection |
Interferes(ref GeoPoint, ref GeoPoint, ref GeoPoint)
Returns true when the triangle defined by tri1, tri2 and tri3
(including the inside of the triangle) and this BoundingCube interfere.
Declaration
public bool Interferes(ref GeoPoint tri1, ref GeoPoint tri2, ref GeoPoint tri3)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | tri1 | First point of triangle |
| GeoPoint | tri2 | Second point of triangle |
| GeoPoint | tri3 | Third point of triangle |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if interference, false otherwise |
Interferes(GeoPoint[])
Checks the interference of this cube with the provided polyline. The array of points
defines a polyline connecting consecutive points.
Declaration
public bool Interferes(GeoPoint[] points)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | points | The polyline |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Interferes(GeoPoint[], Int32[])
Checks the interference of this cube with the provided triangles. The triangles are defined
by three points each. Each triple of indices in triangleIndex defines one
triangle. Not only the edges of the triangle are checked but also the inner surface.
Declaration
public bool Interferes(GeoPoint[] trianglePoint, int[] triangleIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | trianglePoint | Array of vertives of the triangles |
| System.Int32[] | triangleIndex | Indices to |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Interferes(Plane)
Returns true if the given plane intersects the this bounding cube. Returns false otherwise.
Declaration
public bool Interferes(Plane plane)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | plane | The plane to test with |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if intersection |
Interferes(Projection, BoundingRect)
Returns true, if the provided rectangle rect and this BoundingCube interfere with the provided projection.
Declaration
public bool Interferes(Projection projection, BoundingRect rect)
Parameters
| Type | Name | Description |
|---|---|---|
| Projection | projection | The projection |
| BoundingRect | rect | The rectangle |
Returns
| Type | Description |
|---|---|
| System.Boolean | ture if interference, false otherwise |
Interferes(Projection.PickArea)
Checks the interference of this cube with the provided area. The pickarea
is either a rectangular prism of infinite length or a frustum.
Declaration
public bool Interferes(Projection.PickArea area)
Parameters
| Type | Name | Description |
|---|---|---|
| Projection.PickArea | area |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsOnBounds(GeoPoint, Double)
Tests whether the provided point toTest falls on the bounds of this
cube with respect to precision.
Declaration
public bool IsOnBounds(GeoPoint toTest, double precision)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | toTest | Point to test |
| System.Double | precision | Precision for the test |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if on bounds, false otherwise |
MinMax(BoundingCube)
Makes this BoundingCube include the provided BoundingCube. You can start with an EmptyBoundingCube
Declaration
public void MinMax(BoundingCube b)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingCube | b | Cube to be included |
MinMax(GeoPoint)
Makes this BoundingCube include the provided point. You can start with an EmptyBoundingCube
Declaration
public void MinMax(GeoPoint p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | Point to be included |
Modify(ModOp)
Modifies this cube according to the provided modification. If this modification contains a rotation the resulting cube will contain the rotated original cube. BoundingCubes are always axis aligned.
Declaration
public void Modify(ModOp m)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp | m | Modification |
OnSameSide(GeoPoint[])
Declaration
public bool OnSameSide(params GeoPoint[] pnts)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | pnts |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Set(Double, Double, Double, Double, Double, Double)
Declaration
public void Set(double Xmin, double Xmax, double Ymin, double Ymax, double Zmin, double Zmax)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | Xmin | |
| System.Double | Xmax | |
| System.Double | Ymin | |
| System.Double | Ymax | |
| System.Double | Zmin | |
| System.Double | Zmax |
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents this instance. |
Overrides
Operators
| Improve this Doc View SourceAddition(BoundingCube, BoundingCube)
Declaration
public static BoundingCube operator +(BoundingCube b1, BoundingCube b2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingCube | b1 | |
| BoundingCube | b2 |
Returns
| Type | Description |
|---|---|
| BoundingCube |