Table of Contents

Class Box3d

Namespace
Hi.Geom
Assembly
HiGeom.dll

Lightweight 3d box. An orthogonal box which the edges are all parallel with Cartesian Coordinate. The data contains in a Box3d is Min and Max.

public class Box3d : IExpandToBox3d, IEquatable<Box3d>, IStlSource, IGetStl, IMakeXmlSource, IBinaryIo, IWriteBin, IDuplicate
Inheritance
Box3d
Implements
Inherited Members
Extension Methods

Constructors

Box3d()

Ctor.

public Box3d()

Box3d(NoInit)

Ctor. The Ctor keeps Min and Max to null.

public Box3d(Box3d.NoInit noInit)

Parameters

noInit Box3d.NoInit

Box3d(params IExpandToBox3d[])

Creates a box that encompasses all the provided expandable objects.

public Box3d(params IExpandToBox3d[] src)

Parameters

src IExpandToBox3d[]

Array of objects that can expand to a box

Box3d(Vec3d, Vec3d)

Ctor.

public Box3d(Vec3d min, Vec3d max)

Parameters

min Vec3d

Min

max Vec3d

Max

Box3d(box3d)

Ctor.

public Box3d(box3d src)

Parameters

src box3d

src

Box3d(IEnumerable<IExpandToBox3d>)

Creates a box that encompasses all the provided expandable objects.

public Box3d(IEnumerable<IExpandToBox3d> src)

Parameters

src IEnumerable<IExpandToBox3d>

Collection of objects that can expand to a box

Box3d(double, double, double, double, double, double)

Creates a box with the specified minimum and maximum coordinates.

public Box3d(double minx, double miny, double minz, double maxx, double maxy, double maxz)

Parameters

minx double

Minimum X coordinate

miny double

Minimum Y coordinate

minz double

Minimum Z coordinate

maxx double

Maximum X coordinate

maxy double

Maximum Y coordinate

maxz double

Maximum Z coordinate

Box3d(BinaryReader)

Creates a box from binary data.

public Box3d(BinaryReader reader)

Parameters

reader BinaryReader

Binary reader to read the box data from

Box3d(XElement)

Ctor.

public Box3d(XElement src)

Parameters

src XElement

XML

Properties

BottomCenter

Center of the bottom surface.

public Vec3d BottomCenter { get; }

Property Value

Vec3d

BottomView

Gets a transformation matrix for viewing the box from the bottom.

public Mat4d BottomView { get; }

Property Value

Mat4d

Center

Center

public Vec3d Center { get; }

Property Value

Vec3d

CenterUnitBox

Generate a center unit box which min~max is (-0.5,-0.5,-0.5)~(0.5,0.5,0.5).

public static Box3d CenterUnitBox { get; }

Property Value

Box3d

DiagonalLength

Diagonal length.

public double DiagonalLength { get; }

Property Value

double

Dim

Dimension.

public Vec3d Dim { get; }

Property Value

Vec3d

FrontView

Gets a transformation matrix for viewing the box from the front.

public Mat4d FrontView { get; }

Property Value

Mat4d

HasVolume

Checks if the box has a positive volume (all dimensions are greater than zero).

public bool HasVolume { get; }

Property Value

bool

IsAllNaN

True if all components of Min and Max are NaN.

public bool IsAllNaN { get; }

Property Value

bool

IsFinite

True if the box is finite.

public bool IsFinite { get; }

Property Value

bool

IsReversedPoleBox

True if the box is ReversedPoleBox

public bool IsReversedPoleBox { get; }

Property Value

bool

IsometricView

Gets a transformation matrix for viewing the box from an isometric perspective.

public Mat4d IsometricView { get; }

Property Value

Mat4d

LeftSideView

Gets a transformation matrix for viewing the box from the left side.

public Mat4d LeftSideView { get; }

Property Value

Mat4d

Max

Maximum point of the box.

public Vec3d Max { get; set; }

Property Value

Vec3d

Min

Minimum point of the box.

public Vec3d Min { get; set; }

Property Value

Vec3d

NaN

Generate a nan box which min~max is (nan,nan,nan)~(nan,nan,nan).

public static Box3d NaN { get; }

Property Value

Box3d

NativeByteSize

Gets the native byte size of a Box3d (2 Vec3d objects).

public static int NativeByteSize { get; }

Property Value

int

RearView

Gets a transformation matrix for viewing the box from the rear.

public Mat4d RearView { get; }

Property Value

Mat4d

ReversedPoleBox

Generate a reversed pole box which min~max is (∞,∞,∞)~(-∞,-∞,-∞).

public static Box3d ReversedPoleBox { get; }

Property Value

Box3d

RightSideView

Gets a transformation matrix for viewing the box from the right side.

public Mat4d RightSideView { get; }

Property Value

Mat4d

TopCenter

Center of the top surface.

public Vec3d TopCenter { get; }

Property Value

Vec3d

TopView

Gets a transformation matrix for viewing the box from the top.

public Mat4d TopView { get; }

Property Value

Mat4d

UnitBox

Generate a unit box which min~max is (0,0,0)~(1,1,1).

public static Box3d UnitBox { get; }

Property Value

Box3d

Volume

Gets the volume of the box.

public double Volume { get; }

Property Value

double

XName

Name for XML IO.

public static string XName { get; }

Property Value

string

ZeroBox

Generate a zero box which min~max is (0,0,0)~(0,0,0).

public static Box3d ZeroBox { get; }

Property Value

Box3d

Methods

ApexAt(int)

Get Apex at the box.

public Vec3d ApexAt(int index)

Parameters

index int

index 0~7. all of 8 apex.

Returns

Vec3d

Duplicate(params object[])

Creates a deep copy of the object, excluding any source file references.

public object Duplicate(params object[] res)

Parameters

res object[]

Optional parameters that may be needed during the duplication process

Returns

object

A new instance that is a deep copy of the original object

Equals(Box3d)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Box3d other)

Parameters

other Box3d

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Expand(Box3d)

Expands this box to include another box.

public Box3d Expand(Box3d src)

Parameters

src Box3d

The box to include

Returns

Box3d

This box after expansion

Expand(Vec3d)

Expands the box to include the specified point.

public Box3d Expand(Vec3d p)

Parameters

p Vec3d

Point to include in the box

Returns

Box3d

This box after expansion

ExpandToBox3d(Box3d)

Expands the destination box. This function is usually used to compute the bounding box of elements.

public void ExpandToBox3d(Box3d dst)

Parameters

dst Box3d

Destination box

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetStl()

Generate Stl.

public Stl GetStl()

Returns

Stl

stl

GetTransformedBoundingBox(Mat4d)

Get the bounding box of the transformed box.

public Box3d GetTransformedBoundingBox(Mat4d mat)

Parameters

mat Mat4d

matrix

Returns

Box3d

GetTris(ICollection<Tri3d>)

Generates triangles representing the box's surfaces.

public int GetTris(ICollection<Tri3d> dst)

Parameters

dst ICollection<Tri3d>

Collection to add the triangles to

Returns

int

The number of triangles added (12)

IsOverlapped(Box3d)

Is the box overlapped to otherBox.

public bool IsOverlapped(Box3d otherBox)

Parameters

otherBox Box3d

other box

Returns

bool

is overlapped

MakeXmlSource(string, string)

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)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

Returns

XElement

An XML element representing the object's state

MemberAt(int)

Get member at the location.

public Vec3d MemberAt(int iter)

Parameters

iter int

iterator

Returns

Vec3d

Minif iter is 0; otherwise, return Max

ReadBin(BinaryReader)

Reads box data from a binary reader.

public void ReadBin(BinaryReader reader)

Parameters

reader BinaryReader

Binary reader to read the box data from

ScaleFromCenter(double)

Scales the box from its center point.

public Box3d ScaleFromCenter(double s)

Parameters

s double

Scale factor

Returns

Box3d

This box after scaling

Set(Box3d)

Copy the src. The Min and Max are kept the same object. Only the double values changed.

public Box3d Set(Box3d src)

Parameters

src Box3d

src

Returns

Box3d

this

Set(box3d)

Copy the src. The Min and Max are kept the same object. Only the double values changed.

public Box3d Set(box3d src)

Parameters

src box3d

src

Returns

Box3d

this

Set(double, double, double, double, double, double)

Sets the box coordinates to the specified values.

public Box3d Set(double minx, double miny, double minz, double maxx, double maxy, double maxz)

Parameters

minx double

Minimum X coordinate

miny double

Minimum Y coordinate

minz double

Minimum Z coordinate

maxx double

Maximum X coordinate

maxy double

Maximum Y coordinate

maxz double

Maximum Z coordinate

Returns

Box3d

This box after modification

SetToTransformedBoundingBox(Mat4d)

Set the box to the bounding box of the matrix-transformed box.

public Box3d SetToTransformedBoundingBox(Mat4d mat)

Parameters

mat Mat4d

matrix

Returns

Box3d

this

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Translate(Vec3d)

Translate the box.

public Box3d Translate(Vec3d vec)

Parameters

vec Vec3d

translation vector

Returns

Box3d

this

WriteBin(BinaryWriter)

Writes box data to a binary writer.

public void WriteBin(BinaryWriter writer)

Parameters

writer BinaryWriter

Binary writer to write the box data to