pub struct Path {
pub curve_path: CurvePath<Vector2>,
pub current_point: Vector2,
}Expand description
Path: a 2D CurvePath with a canvas-like drawing API (moveTo,
lineTo, bezierCurveTo, …).
three.js’ Path extends CurvePath; here a Path holds its CurvePath
and derefs to it, so path.curves, path.auto_close and
path.close_path() read as they do in JavaScript. The builder methods
return &mut Self for chaining, as three.js’ return this.
Fields§
§curve_path: CurvePath<Vector2>The inherited CurvePath state.
current_point: Vector2The current offset of the path. Any new curve added will start here.
Implementations§
Source§impl Path
impl Path
Sourcepub fn from_points(points: &[Vector2]) -> Self
pub fn from_points(points: &[Vector2]) -> Self
new Path( points ): setFromPoints( points ) on a new path.
Sourcepub fn set_from_points(&mut self, points: &[Vector2]) -> &mut Self
pub fn set_from_points(&mut self, points: &[Vector2]) -> &mut Self
Path.setFromPoints( points ): a moveTo to the first point and a
lineTo to each of the rest.
Sourcepub fn quadratic_curve_to(
&mut self,
a_c_px: f64,
a_c_py: f64,
a_x: f64,
a_y: f64,
) -> &mut Self
pub fn quadratic_curve_to( &mut self, a_c_px: f64, a_c_py: f64, a_x: f64, a_y: f64, ) -> &mut Self
Path.quadraticCurveTo( aCPx, aCPy, aX, aY ).
Sourcepub fn bezier_curve_to(
&mut self,
a_cp1x: f64,
a_cp1y: f64,
a_cp2x: f64,
a_cp2y: f64,
a_x: f64,
a_y: f64,
) -> &mut Self
pub fn bezier_curve_to( &mut self, a_cp1x: f64, a_cp1y: f64, a_cp2x: f64, a_cp2y: f64, a_x: f64, a_y: f64, ) -> &mut Self
Path.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ).
Sourcepub fn spline_thru(&mut self, pts: &[Vector2]) -> &mut Self
pub fn spline_thru(&mut self, pts: &[Vector2]) -> &mut Self
Path.splineThru( pts ): a SplineCurve from the current point
through pts.
Sourcepub fn arc(
&mut self,
a_x: f64,
a_y: f64,
a_radius: f64,
a_start_angle: f64,
a_end_angle: f64,
a_clockwise: bool,
) -> &mut Self
pub fn arc( &mut self, a_x: f64, a_y: f64, a_radius: f64, a_start_angle: f64, a_end_angle: f64, a_clockwise: bool, ) -> &mut Self
Path.arc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ):
absarc with the center relative to the current point.
Sourcepub fn absarc(
&mut self,
a_x: f64,
a_y: f64,
a_radius: f64,
a_start_angle: f64,
a_end_angle: f64,
a_clockwise: bool,
) -> &mut Self
pub fn absarc( &mut self, a_x: f64, a_y: f64, a_radius: f64, a_start_angle: f64, a_end_angle: f64, a_clockwise: bool, ) -> &mut Self
Path.absarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ).
Sourcepub fn ellipse(
&mut self,
a_x: f64,
a_y: f64,
x_radius: f64,
y_radius: f64,
a_start_angle: f64,
a_end_angle: f64,
a_clockwise: bool,
a_rotation: f64,
) -> &mut Self
pub fn ellipse( &mut self, a_x: f64, a_y: f64, x_radius: f64, y_radius: f64, a_start_angle: f64, a_end_angle: f64, a_clockwise: bool, a_rotation: f64, ) -> &mut Self
Path.ellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ): absellipse with the
center relative to the current point.
Sourcepub fn absellipse(
&mut self,
a_x: f64,
a_y: f64,
x_radius: f64,
y_radius: f64,
a_start_angle: f64,
a_end_angle: f64,
a_clockwise: bool,
a_rotation: f64,
) -> &mut Self
pub fn absellipse( &mut self, a_x: f64, a_y: f64, x_radius: f64, y_radius: f64, a_start_angle: f64, a_end_angle: f64, a_clockwise: bool, a_rotation: f64, ) -> &mut Self
Path.absellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ). Joins the previous curve to the ellipse’s
start with a line when they do not meet.
Methods from Deref<Target = CurvePath<Vector2>>§
Sourcepub fn update_arc_lengths(&self)
pub fn update_arc_lengths(&self)
CurvePath.updateArcLengths().
Sourcepub fn get_curve_lengths(&self) -> Vec<f64>
pub fn get_curve_lengths(&self) -> Vec<f64>
CurvePath.getCurveLengths(): the running sum of the sub-curves’
lengths, cached while the curve count is unchanged.
Sourcepub fn close_path(&mut self) -> &mut Self
pub fn close_path(&mut self) -> &mut Self
CurvePath.closePath(): adds a line curve back to the start if the
path does not already end there.
Trait Implementations§
Source§impl Curve for Path
impl Curve for Path
Source§fn arc_length_divisions(&self) -> usize
fn arc_length_divisions(&self) -> usize
Curve.arcLengthDivisions, default 200.Source§fn get_point(&self, t: f64) -> Vector2
fn get_point(&self, t: f64) -> Vector2
Curve.getPoint( t, optionalTarget ). t is an interpolation factor in
[0,1].Source§fn get_length(&self) -> f64
fn get_length(&self) -> f64
Curve.getLength().Source§fn get_lengths(&self, divisions: usize) -> Vec<f64>
fn get_lengths(&self, divisions: usize) -> Vec<f64>
Curve.getLengths( divisions ). See the module doc: no cache.Source§fn get_spaced_points(&self, divisions: usize) -> Vec<Vector2>
fn get_spaced_points(&self, divisions: usize) -> Vec<Vector2>
Curve.getSpacedPoints( divisions ); returns divisions + 1 points.Source§fn get_points(&self, divisions: usize) -> Vec<Vector2>
fn get_points(&self, divisions: usize) -> Vec<Vector2>
Curve.getPoints( divisions ); returns divisions + 1 points.Source§fn curve_path_resolution(&self, divisions: usize) -> usize
fn curve_path_resolution(&self, divisions: usize) -> usize
CurvePath.getPoints( divisions ) asks this curve
for. three.js writes it as a chain of brand checks in CurvePath:
isEllipseCurve doubles it, isLineCurve / isLineCurve3 use 1 and
isSplineCurve multiplies by its point count; every other curve uses
divisions as given. Here each of those subclasses overrides this.Source§fn is_closed_catmull_rom(&self) -> bool
fn is_closed_catmull_rom(&self) -> bool
extrudePath.isCatmullRomCurve3 ? extrudePath.closed : false — the one
place three.js reads a subclass’ closed generically
(ExtrudeGeometry). Only CatmullRomCurve3
overrides it.Source§fn get_point_at(&self, u: f64) -> Self::Point
fn get_point_at(&self, u: f64) -> Self::Point
Curve.getPointAt( u, optionalTarget ).Source§fn get_u_to_t_mapping(&self, u: f64, distance: Option<f64>) -> f64
fn get_u_to_t_mapping(&self, u: f64, distance: Option<f64>) -> f64
Curve.getUtoTmapping( u, distance ), statement for statement.Source§fn get_tangent(&self, t: f64) -> Self::Point
fn get_tangent(&self, t: f64) -> Self::Point
Curve.getTangent( t, optionalTarget ).Source§fn get_tangent_at(&self, u: f64) -> Self::Point
fn get_tangent_at(&self, u: f64) -> Self::Point
Curve.getTangentAt( u, optionalTarget ).Source§fn compute_frenet_frames(&self, segments: usize, closed: bool) -> FrenetFrames
fn compute_frenet_frames(&self, segments: usize, closed: bool) -> FrenetFrames
Curve.computeFrenetFrames( segments, closed ). Read more