Class GeomUtil
Utility of Geometry.
public static class GeomUtil
- Inheritance
-
GeomUtil
- Inherited Members
Methods
ExpandToBox3d(IExpandToBox3d, mat4d_t, ref box3d_t)
Expands the destination bounding box with the transformed bounding box of source under matrix mat.
public static void ExpandToBox3d(this IExpandToBox3d src, mat4d_t mat, ref box3d_t dst)
Parameters
srcIExpandToBox3dThe source geometry
matmat4d_tThe transformation matrix
dstbox3d_tThe destination bounding box
GetBox3d(IExpandToBox3d)
Gets a box3d_t representation of the specified object that implements IExpandToBox3d.
public static box3d_t GetBox3d(this IExpandToBox3d src)
Parameters
srcIExpandToBox3dThe source object that implements IExpandToBox3d.
Returns
- box3d_t
A box3d_t representation of the source object.
GetNearestPointOnLineSegment(vec2d_t, vec2d_t, vec2d_t)
Get the nearest point on a line segment to a given point.
public static vec2d_t GetNearestPointOnLineSegment(vec2d_t point, vec2d_t lineStart, vec2d_t lineEnd)
Parameters
pointvec2d_tThe point to find the nearest point from
lineStartvec2d_tStart point of the line segment
lineEndvec2d_tEnd point of the line segment
Returns
- vec2d_t
The nearest point on the line segment
GetNearestPointOnLineSegment(vec3d_t, vec3d_t, vec3d_t)
Get the nearest point on a line segment to a given point.
public static vec3d_t GetNearestPointOnLineSegment(vec3d_t point, vec3d_t lineStart, vec3d_t lineEnd)
Parameters
pointvec3d_tThe point to find the nearest point from
lineStartvec3d_tStart point of the line segment
lineEndvec3d_tEnd point of the line segment
Returns
- vec3d_t
The nearest point on the line segment
GetRayIntersection(vec3d_t, vec3d_t, vec3d_t, vec3d_t)
Calculates the intersection point of two rays in 3D space.
public static vec3d_t GetRayIntersection(vec3d_t rayABegin, vec3d_t rayAVec, vec3d_t rayBBegin, vec3d_t rayBVec)
Parameters
rayABeginvec3d_tThe starting point of the first ray.
rayAVecvec3d_tThe direction vector of the first ray.
rayBBeginvec3d_tThe starting point of the second ray.
rayBVecvec3d_tThe direction vector of the second ray.
Returns
- vec3d_t
The point on the second line (
rayBBegin+rayBVec*t, t may be negative) where the two infinite lines meet; for skew lines it is the point on the second line whose offset from the first has no component along their cross product. When the direction vectors are parallel (their cross product is zero) every component is NaN; test the cross product before calling when the parallel case matters.
IntersectLineSegmentCircle(vec2d_t, vec2d_t, double, out vec2d_t?, out vec2d_t?)
Intersect line segment and circle.
public static double IntersectLineSegmentCircle(vec2d_t p0, vec2d_t p1, double rr, out vec2d_t? pA, out vec2d_t? pB)
Parameters
p0vec2d_tline segment begin point
p1vec2d_tline segment end point
rrdoubleradius*radius
pAvec2d_t?first intersect point along
p0top1; null when the determinant is not positive or that root lies outside the segmentpBvec2d_t?second intersect point along
p0top1; null when the determinant is not positive or that root lies outside the segment
Returns
- double
determinant