Peforming Projections

projectPointOnEdge()

Creates a Face from specified edges

Syntax

cadlib._projectPointOnEdge(point, edges);

Parameters

Name Type Description
point Point Point object to use for projection
edge Edge Target edge

Returns


{
    distance,   // distance between point1 and point2
    point1,     // Source point used for projection {x,y,z}
    point2      // The projected point at the edge {x,y,z}
}

projectPointOnFace()

Creates a Face from specified edges

Syntax

cadlib.projectPointOnFace(point, edges);

Parameters

Name Type Description
point Point Point object to use for projection
face Face Target Face

Returns


{
    distance,   // distance between point1 and point2
    point1,     // Source point used for projection {x,y,z}
    point2      // The projected point at the edge {x,y,z}
}

projectShapeOnShape()

Creates a Face from specified edges

Syntax

cadlib._projectShapeOnShape(shape, face, options);

Parameters

Name Type Description
shape Shape Shape to project
face Face Target face on which to project shape
options Object { maxDistance: limitToFace: <true

Returns

Wire or Edge


getFaceUVFromPoint()

Gets UV parameters of a point on a face

Syntax

cadlib.getFaceUVFromPoint(face, point);

Parameters

Name Type Description
face Face Target Face
point Point A point on the face

Returns

{ x, y } where x is the U co-ordinate, y is the V co-ordiante


getFacePointFromUV()

Gets point and surface normal on a face with at a given UV

Syntax

cadlib.getFacePointFromUV(face, uv)

Parameters

Name Type Description
face Face Target face
uv UV { x, y }, where x is the U co-ordinate and y is the V co-ordinate

Returns

 {
     point,  // Vec3
     normal  // normal at point on the face
 }