Class Box3d
The axis-aligned box as a geometry kind: what a workpiece, a fixture, a holder, a cutter beam,
a transformation geometry or a combination holds beside Cylindroid,
StlFile, ExtendedCylinder, TransformationGeom (HiMech) and
GeomCombination — the XML element Box3d, the mesh, the presentation DTO
and the selection name “Box”. The box itself is the value Box, a
box3d_t: every bound, corner, expansion and view is computed there, and this
class carries none of that API (a bounding box is new box3d_t(geom) through
IExpandToBox3d). Being a class, the object an owner holds is the object a
registry key or an editor names, so writing Box through either reaches the owner.
public class Box3d : IStlSource, IGetStl, IMakeXmlSource, IExpandToBox3d, IDuplicate, IToPresentDto
- Inheritance
-
Box3d
- Implements
- Inherited Members
- Extension Methods
Constructors
Box3d()
Ctor: the zero box, ZeroBox.
public Box3d()
Box3d(box3d_t)
Ctor.
public Box3d(box3d_t box)
Parameters
Box3d(vec3d_t, vec3d_t)
Ctor.
public Box3d(vec3d_t min, vec3d_t max)
Parameters
Box3d(double, double, double, double, double, double)
Ctor by the six coordinates.
public Box3d(double minx, double miny, double minz, double maxx, double maxy, double maxz)
Parameters
minxdoubleMinimum X coordinate
minydoubleMinimum Y coordinate
minzdoubleMinimum Z coordinate
maxxdoubleMaximum X coordinate
maxydoubleMaximum Y coordinate
maxzdoubleMaximum Z coordinate
Box3d(XElement)
Ctor.
public Box3d(XElement src)
Parameters
srcXElementXML:
<Box3d><Min>…</Min><Max>…</Max></Box3d>
Properties
Box
The box. A value: assign a whole box3d_t (geom.Box = geom.Box.Expanded(p));
writing a corner on the property receiver is a compile error.
public box3d_t Box { get; set; }
Property Value
XName
Name for XML IO: Box3d, the element name of the value's own XML form
(XName), which this geometry reads and writes unchanged. It is the
file and wire contract, not the class name.
public static string XName { get; }
Property Value
Methods
Duplicate(params object[])
Creates a deep copy of the object, excluding any source file references.
public object Duplicate(params object[] res)
Parameters
resobject[]Optional parameters that may be needed during the duplication process
Returns
- object
A new instance that is a deep copy of the original object
ExpandToBox3d(ref box3d_t)
Expands the destination box.
This function is usually used to compute the bounding box of elements.
box3d_t is a value type, so the destination is passed by reference
(the C++ expand_to_box3d(box3&) shape); an implementation writes
dst = dst.Expanded(...) or forwards ref dst to its parts.
public void ExpandToBox3d(ref box3d_t dst)
Parameters
dstbox3d_tDestination box, expanded in place
GetStl()
Gets the STL geometry data.
public Stl GetStl()
Returns
- Stl
The STL geometry object
GetTris(ICollection<tri3d_t>)
Adds the twelve face triangles of Box (GetTris(ICollection<tri3d_t>)).
public int GetTris(ICollection<tri3d_t> dst)
Parameters
dstICollection<tri3d_t>Collection to add the triangles to
Returns
- int
The number of triangles added (12)
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory
ToPresentDto()
The presentation DTO of Box: Type “Box3d”, Min, Max
(ToPresentDto()).
public object ToPresentDto()
Returns
- object
DTO dictionary with Type, Min, Max keys
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.