trimesh.path.arc

Functions

arc_center(points)

Given three points on an arc find: center, radius, normal, and angle.

discretize_arc(points[, close, scale])

Returns a version of a three point arc consisting of line segments.

to_threepoint(center, radius[, angles])

For 2D arcs, given a center and radius convert them to three points on the arc.

trimesh.path.arc.arc_center(points)

Given three points on an arc find: center, radius, normal, and angle.

This uses the fact that the intersection of the perp bisectors of the segments between the control points is the center of the arc.

Parameters

points ((3, dimension) float) – Points in space, where dimension is either 2 or 3

Returns

result – Contains the arc center and other information: {‘center’ : (d,) float, cartesian center of the arc

’radius’ : float, radius of the arc ‘normal’ : (3,) float, the plane normal. ‘angle’ : (2,) float, angle of start and end in radians ‘span’ : float, angle swept by the arc in radians}

Return type

dict

trimesh.path.arc.discretize_arc(points, close=False, scale=1.0)

Returns a version of a three point arc consisting of line segments.

Parameters
  • points ((3, d) float) – Points on the arc where d in [2,3]

  • close (boolean) – If True close the arc into a circle

  • scale (float) – What is the approximate overall drawing scale Used to establish order of magnitude for precision

Returns

discrete – Connected points in space

Return type

(m, d) float

trimesh.path.arc.to_threepoint(center, radius, angles=None)

For 2D arcs, given a center and radius convert them to three points on the arc.

Parameters
  • center ((2,) float) – Center point on the plane

  • radius (float) – Radius of arc

  • angles ((2,) float) – Angles in radians for start and end angle if not specified, will default to (0.0, pi)

Returns

three – Arc control points

Return type

(3, 2) float