Version 0.64.1

snap_points_to

Pulls a list of vector positions to the closest point on an object.

Signatures

  •   snap_points_to( solid obj, vector pos[] )
  •   snap_points_to( solid obj, vector pos[], vector& normal[] )

Details

The function finds the closest points for each element of a given set of vector positions to an object obj.

Example

 solid cyl = cylinder( 3, 10 )
 vector points[] = [ <[ 5, 0, 0 ]>, <[ 0, 5, 0 ]>, <[ 0, 0, 5 ]> ]
 vector closestPoints[] = snap_points_to( cyl, points )
 echo( closestPoints )
 

Output

 <vector>[<[5,1.41638e-15,0]>,<[-5.66554e-15,5,0]>,<[0,0,3]>] 

Return value

Returns an array of vectors of the size of pos that holds the closest point on obj for each position in pos.

Parameters

obj

Geometric object the closest points are determined on.

pos

A list of start positions.

normal

Returns an array of vectors. These are the surface normals at the closest points.

See also

🗙

Search results for