Intersect
verb.eval.Intersect
CLASS
Intersect
provides various tools for all kinds of intersection. This includes but not limited to:
- curves
- surfaces
- meshes
- polylines
Under the hood, most of these algorithms call the recursive bounding box intersection algorithm
(Intersect.boundingBoxTrees<T1, T2>
) followed by some kind of minimization.
surfaces
STATIC METHOD
surfaces(surface0 : NurbsSurfaceData, surface1 : NurbsSurfaceData, tol : Float) : Array<NurbsCurveData>
Intersect two NURBS surfaces, yielding a list of curves
params
- NurbsSurfaceData for the first surface
- NurbsSurfaceData for the second
returns
- array of NurbsCurveData objects
surfacesAtPointWithEstimate
STATIC METHOD
surfacesAtPointWithEstimate(surface0 : NurbsSurfaceData, surface1 : NurbsSurfaceData, uv1 : UV, uv2 : UV, tol : Float) : SurfaceSurfaceIntersectionPoint
Refine a pair of surface points to a point where the two surfaces intersect
params
- NurbsSurfaceData for the first surface
- NurbsSurfaceData for the second
- the UV for the point on the first surface
- the UV for the point on the second surface
- a tolerance value to terminate the refinement procedure
returns
- a SurfaceSurfaceIntersectionPoint object
meshes
STATIC METHOD
meshes(mesh0 : MeshData, mesh1 : MeshData, bbtree0 : IBoundingBoxTree<Int>, bbtree1 : IBoundingBoxTree<Int>) : Array<Array<MeshIntersectionPoint>>
Intersect two meshes, yielding a list of polylines
params
- MeshData for the first mesh
- MeshData for the latter
- optional boundingbox tree for first mesh
- optional boundingbox tree for second mesh
returns
- array of array of MeshIntersectionPoints
meshSlices
STATIC METHOD
meshSlices(mesh : MeshData, min : Float, max : Float, step : Float) : Array<Array<Array<MeshIntersectionPoint>>>
Slice a mesh by repeated planar intersections yielding a sequence of polylines. Each plane is along the z axis, so you'll need to transform your mesh if you wish to cut in any other direction.
params
- MeshData for the mesh to be sliced
- Minimum z value
- Maximum z value
- Step size
returns
- array of array of array of MeshIntersectionPoints - corresponding to the collection of polylines formed with each slice
makeMeshIntersectionPolylines
STATIC METHOD
makeMeshIntersectionPolylines(segments : Array<Interval<MeshIntersectionPoint>>) : Array<Array<MeshIntersectionPoint>>
Given a list of unstructured mesh intersection segments, reconstruct into polylines
params
- unstructured collection of segments
returns
- array of array of MeshIntersectionPoint
lookupAdjacentSegment
STATIC METHOD
lookupAdjacentSegment(segEnd : MeshIntersectionPoint, tree : KdTree<MeshIntersectionPoint>, numResults : Int)
Given a segment end
params
- unstructured collection of segments
returns
- array of array of MeshIntersectionPoint
curveAndSurface
STATIC METHOD
curveAndSurface(curve : NurbsCurveData, surface : NurbsSurfaceData, tol : Float, e-3 : undefined, crvBbTree : IBoundingBoxTree<NurbsCurveData>, srfBbTree : IBoundingBoxTree<NurbsSurfaceData>) : Array<CurveSurfaceIntersection>
Get the intersection of a NURBS curve and a NURBS surface without an estimate
params
- NurbsCurveData
- NurbsSurfaceData
- tolerance for the curve intersection
returns
- array of CurveSurfaceIntersection objects
curveAndSurfaceWithEstimate
STATIC METHOD
curveAndSurfaceWithEstimate(curve : NurbsCurveData, surface : NurbsSurfaceData, start_params : Array<Float>, tol : Float, e-3 : undefined) : CurveSurfaceIntersection
Refine an intersection pair for a surface and curve given an initial guess. This is an unconstrained minimization, so the caller is responsible for providing a very good initial guess.
params
- NurbsCurveData
- NurbsSurfaceData
- array of initial parameter values [ u_crv, u_srf, v_srf ]
returns
- a CurveSurfaceIntersection object
polylineAndMesh
STATIC METHOD
polylineAndMesh(polyline : PolylineData, mesh : MeshData, tol : Float) : Array<PolylineMeshIntersection>
Approximate the intersection of a polyline and mesh while maintaining parameter information
params
- PolylineData
- MeshData
returns
- an array of PolylineMeshIntersection object
curves
STATIC METHOD
curves(curve1 : NurbsCurveData, curve2 : NurbsCurveData, tolerance : Float) : Array<CurveCurveIntersection>
Approximate the intersection of two NURBS curves
params
- NurbsCurveData object representing the first NURBS curve
- NurbsCurveData object representing the second NURBS curve
- tolerance for the intersection
returns
- the intersections
triangles
STATIC METHOD
triangles(mesh0 : MeshData, faceIndex0 : Int, mesh1 : MeshData, faceIndex1 : Int) : Interval<MeshIntersectionPoint>
Intersect two triangles
params
- array of length 3 arrays of numbers representing the points of mesh1
- array of length 3 arrays of number representing the triangles of mesh1
- array of length 3 arrays of numbers representing the points of mesh2
- array of length 3 arrays of number representing the triangles of mesh2
returns
- a point represented by an array of length (dim)
clipRayInCoplanarTriangle
STATIC METHOD
clipRayInCoplanarTriangle(ray : Ray, mesh : MeshData, faceIndex : Int) : Interval<CurveTriPoint>
mergeTriangleClipIntervals
STATIC METHOD
mergeTriangleClipIntervals(clip1 : Interval<CurveTriPoint>, clip2 : Interval<CurveTriPoint>, mesh1 : MeshData, faceIndex1 : Int, mesh2 : MeshData, faceIndex2 : Int) : Interval<MeshIntersectionPoint>
planes
STATIC METHOD
planes(origin0 : Point, normal0 : Vector, origin1 : Point, normal1 : Vector) : Ray
Intersect two planes, yielding a Ray
params
- point in plane 0
- normal to plane 0
- point in plane 1
- normal to plane 1
returns
- a point represented by an array of length (dim)
threePlanes
STATIC METHOD
threePlanes(n0 : Point, d0 : Float, n1 : Point, d1 : Float, n2 : Point, d2 : Float) : Point
Intersect three planes, expects the planes to form a single point of intersection
params
- normal for plane 0
- d for plane 0 ( where the plane eq is normal * (x,y,z) = d )
- normal for plane 1
- d for plane 1 ( where the plane eq is normal * (x,y,z) = d )
- normal for plane 2
- d for plane 2 ( where the plane eq is normal * (x,y,z) = d )
returns
- the point representing the intersection
polylines
STATIC METHOD
polylines(polyline0 : PolylineData, polyline1 : PolylineData, tol : Float) : Array<CurveCurveIntersection>
Intersect two polyline curves, keeping track of parameterization on each
params
- PolylineData for first polyline
- PolylineData for second polyline
- tolerance for the intersection
returns
- array of parameter pairs representing the intersection of the two parameteric polylines
segments
STATIC METHOD
segments(a0 : Point, a1 : Point, b0 : Point, b1 : Point, tol : Float) : CurveCurveIntersection
Find the closest parameter on two rays, see http://geomalgorithms.com/a07-_distance.html
params
- first end of the first segment
- second end of the first segment
- first end of the second segment
- second end of the second segment
- tolerance for the intersection
returns
- a CurveCurveIntersection object
rays
STATIC METHOD
rays(a0 : Point, a : Point, b0 : Point, b : Point) : CurveCurveIntersection
Find the closest parameter on two rays, see http://geomalgorithms.com/a07-_distance.html
params
- origin for ray 1
- direction of ray 1, assumed normalized
- origin for ray 1
- direction of ray 1, assumed normalized
returns
- a CurveCurveIntersection object
segmentWithTriangle
STATIC METHOD
segmentWithTriangle(p0 : Point, p1 : Point, points : Array<Point>, tri : Tri) : TriSegmentIntersection
Intersect segment with triangle (from http://geomalgorithms.com/a06-_intersect-2.html)
params
- array of length 3 representing first point of the segment
- array of length 3 representing second point of the segment
- array of length 3 arrays representing the points of the triangle
- array of length 3 containing int indices in the array of points, this allows passing a full mesh
returns
- a TriangleSegmentIntersection or null if failed
segmentAndPlane
STATIC METHOD
segmentAndPlane(p0 : Point, p1 : Point, v0 : Point, n : Point)
Intersect ray/segment with plane (from http://geomalgorithms.com/a06-_intersect-2.html)
If intersecting a ray, the param needs to be between 0 and 1 and the caller is responsible for making that check
params
- array of length 3 representing first point of the segment
- array of length 3 representing second point of the segment
- array of length 3 representing an origin point on the plane
- array of length 3 representing the normal of the plane
returns null or an object with a p property representing the param on the segment
IBoundingBoxTree
verb.eval.IBoundingBoxTree<T>
INTERFACE
boundingBox
METHOD
boundingBox() : BoundingBox
split
METHOD
split() : Pair<IBoundingBoxTree<T>, IBoundingBoxTree<T>>
yield
METHOD
yield() : T
indivisible
METHOD
indivisible(tolerance : Float) : Bool
empty
METHOD
empty() : Bool