OBB Class |
The OBB class represents an oriented 3d bounding box.
Inheritance Hierarchy
Namespace: Tekla.Structures.Geometry3d
Assembly: Tekla.Structures (in Tekla.Structures.dll) Version: 2023.0.3
Syntax
The OBB type exposes the following members.
Constructors
Name | Description | |
---|---|---|
OBB |
Initializes a new instance of the OBB class.
| |
OBB(OBB) |
Initializes a new instance of the OBB class.
| |
OBB(Point, Vector, Double) |
Initializes a new instance of the OBB class.
| |
OBB(Point, Vector, Vector, Vector, Double, Double, Double) |
Initializes a new instance of the OBB class.
|
Properties
Name | Description | |
---|---|---|
Axis0 |
Gets an axis parallel to one side of the OBB,
a unit-length vector orthogonal to Axis1 and Axis2.
| |
Axis1 |
Gets an axis parallel to the second side of the OBB,
a unit-length vector orthogonal to Axis0 and Axis2.
| |
Axis2 |
Gets an axis parallel to the third side of the OBB,
a unit-length vector orthogonal to Axis0 and Axis1.
| |
Center |
Gets or sets the center point of the box.
| |
Extent0 |
Gets or sets the extent parallel to Axis0.
| |
Extent1 |
Gets or sets the extent parallel to Axis1.
| |
Extent2 |
Gets or sets the extent parallel to Axis2.
|
Methods
Name | Description | |
---|---|---|
ClosestPointTo(Line) |
Calculates the closest point in OBB to given Line.
| |
ClosestPointTo(LineSegment) |
Calculates the closest point in OBB to given LineSegment.
| |
ClosestPointTo(Point) |
Calculates the closest point in OBB to given point.
| |
ComputeVertices |
Calculates the corner points of the OBB.
| |
DistanceTo(Line) |
Calculates the distance from OBB to given Line.
| |
DistanceTo(LineSegment) |
Calculates the distance from OBB to given LineSegment.
| |
DistanceTo(Point) |
Calculates the distance from OBB to given point.
| |
Equals(Object) |
Tests for the exact equality of two OBBs.
(Overrides ObjectEquals(Object).) | |
Equals(OBB) |
Tests for the exact equality of two OBBs.
| |
GetHashCode |
Gets the hash code for the obb.
(Overrides ObjectGetHashCode.) | |
IntersectionPointsWith(Line) |
Calculates the intersection points between OBB and given Line.
| |
IntersectionPointsWith(LineSegment) |
Calculates the intersection points between OBB and given LineSegment.
| |
IntersectionWith(Line) |
Creates an intersection between the OBB and the given Line.
| |
IntersectionWith(LineSegment) |
Creates an intersection between the OBB and the given LineSegment.
| |
Intersects(GeometricPlane) |
Tests if current OBB intersects with the given GeometricPlane
| |
Intersects(Line) |
Tests if current OBB intersects with the given Line
| |
Intersects(LineSegment) |
Tests if current OBB intersects with the given LineSegment
| |
Intersects(OBB) |
Tests if current OBB intersects with the given OBB
| |
SetAxis(Vector) |
Sets the Axis to the OBB.
| |
SetAxis(Vector, Vector, Vector) |
Sets the Axis to the OBB.
| |
SetExtent(Double) |
Sets the extents to the OBB.
| |
SetExtent(Double, Double, Double) |
Sets the extents to the OBB.
| |
ShortestSegmentTo(Line) |
Calculates the shortest LineSegment from OBB to the given Line.
| |
ShortestSegmentTo(LineSegment) |
Calculates the shortest LineSegment from OBB to the given LineSegment.
| |
ShortestSegmentTo(Point) |
Calculates the shortest LineSegment from OBB to the given point.
|
Examples
using System; using Tekla.Structures.Geometry3d; using Tekla.Structures.Model; public class Example { public void Example1() { OBB obb = null; // In this simplified example, there are two existing beams in the model. ModelObjectEnumerator beamsEnumerator = TeklaModel.GetModelObjectSelector().GetAllObjectsWithType(ModelObject.ModelObjectEnum.BEAM); if (beamsEnumerator != null) { while (beamsEnumerator.MoveNext()) { Beam beam = beamsEnumerator.Current as Beam; if (beam != null) { if (obb == null) { obb = CreateOrientedBoundingBox(beam); } else { if (obb.Intersects(CreateOrientedBoundingBox(beam))) { // Boxes intersect. } else { // Boxes did not intersect. } } } } } } private Point CalculateCenterPoint(Point min, Point max) { double x = min.X + ((max.X - min.X) / 2); double y = min.Y + ((max.Y - min.Y) / 2); double z = min.Z + ((max.Z - min.Z) / 2); return new Point(x, y, z); } private OBB CreateOrientedBoundingBox(Beam beam) { OBB obb = null; if (beam != null) { WorkPlaneHandler workPlaneHandler = TeklaModel.GetWorkPlaneHandler(); TransformationPlane originalTransformationPlane = workPlaneHandler.GetCurrentTransformationPlane(); Solid solid = beam.GetSolid(); Point minPointInCurrentPlane = solid.MinimumPoint; Point maxPointInCurrentPlane = solid.MaximumPoint; Point centerPoint = CalculateCenterPoint(minPointInCurrentPlane, maxPointInCurrentPlane); CoordinateSystem coordSys = beam.GetCoordinateSystem(); TransformationPlane localTransformationPlane = new TransformationPlane(coordSys); workPlaneHandler.SetCurrentTransformationPlane(localTransformationPlane); solid = beam.GetSolid(); Point minPoint = solid.MinimumPoint; Point maxPoint = solid.MaximumPoint; double extent0 = (maxPoint.X - minPoint.X) / 2; double extent1 = (maxPoint.Y - minPoint.Y) / 2; double extent2 = (maxPoint.Z - minPoint.Z) / 2; workPlaneHandler.SetCurrentTransformationPlane(originalTransformationPlane); obb = new OBB(centerPoint, coordSys.AxisX, coordSys.AxisY, coordSys.AxisX.Cross(coordSys.AxisY), extent0, extent1, extent2); } return obb; } }
See Also