From 8abdb43aabd4f77bd33f412a9b13eec4e02d67e0 Mon Sep 17 00:00:00 2001 From: Ovnuniarchos Date: Tue, 20 Oct 2015 17:47:45 +0200 Subject: Documented classes Curve*, Path*, and PathFollow* --- doc/base/classes.xml | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 157d49fbc8..0a6f6c0092 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -8712,14 +8712,18 @@ + Describes a Bezier curve in 2D space. + This class describes a Bezier curve in 2D space. It is mainly used to give a shape to a [Path2D], but can be manually sampled for other purposes. +It keeps a cache of precalculated points along the curve, to speed further calculations up. + Returns the number of points describing the curve. @@ -8732,6 +8736,8 @@ + Adds a point to a curve, at position "pos", with control points "in" and "out". +If "atpos" is given, the point is inserted before the point number "atpos", moving that point (and every point after) after the inserted point. If "atpos" is not given, or is an illegal value (atpos <0 or atpos >= [method get_point_count]), the point will be appended at the end of the point list. @@ -8740,6 +8746,7 @@ + Sets the position for the vertex "idx". If the index is out of bounds, the function sends an error to the console. @@ -8748,6 +8755,7 @@ + Returns the position of the vertex "idx". If the index is out of bounds, the function sends an error to the console, and returns (0, 0). @@ -8756,6 +8764,7 @@ + Sets the position of the control point leading to the vertex "idx". If the index is out of bounds, the function sends an error to the console. @@ -8764,6 +8773,7 @@ + Returns the position of the control point leading to the vertex "idx". If the index is out of bounds, the function sends an error to the console, and returns (0, 0). @@ -8772,6 +8782,7 @@ + Sets the position of the control point leading out of the vertex "idx". If the index is out of bounds, the function sends an error to the console. @@ -8780,12 +8791,14 @@ + Returns the position of the control point leading out of the vertex "idx". If the index is out of bounds, the function sends an error to the console, and returns (0, 0). + Deletes the point "idx" from the curve. Sends an error to the console if "idx" is out of bounds. @@ -8796,6 +8809,8 @@ + Returns the position between the vertex "idx" and the vertex "idx"+1, where "t" controls if the point is the first vertex (t = 0.0), the last vertex (t = 1.0), or in between. Values of "t" outside the range (0.0 >= t <=1) give strange, but predictable results. +If "idx" is out of bounds it is truncated to the first or last vertex, and "t" is ignored. If the curve has no points, the function sends an error to the console, and returns (0, 0). @@ -8804,24 +8819,28 @@ + Returns the position at the vertex "fofs". It calls [method interpolate] using the integer part of fofs as "idx", and its fractional part as "t". + Sets the distance in pixels between two adjacent cached points. Changing it forces the cache to be recomputed the next time a xxx_baked_xxx function is called. The less distance, the more points the cache will have, and the more memory it will consume, so use with care. + Returns the distance between two adjacent cached points. + Returns the total length of the curve, based on the cached points. Given enough density (see [method set_bake_interval]), it should be approximate enough. @@ -8832,12 +8851,30 @@ + Returns a point within the curve at position "offset", where "offset" is measured as a pixel distance along the curve. +To do that, it finds the two cached points where the "offset" lies between, then interpolates the values. This interpolation is cubic if "cubic" is set to true, or linear if set to false. +Cubic interpolation tends to follow the curves better, but linear is faster (and often, precise enough). + Returns the cache of points as a [Vector2Array]. + + + + + + + + + + + Returns a list of points along the curve, with a curvature controlled point density. That is, the curvier parts will have more points than the straighter parts. +This approximation makes straight segments between each point, then subdivides those segments until the resulting shape is similar enough. +"max_stages" controls how many subdivisions a curve segment may face before it is considered approximate enough. Each subdivision splits the segment in half, so the default 5 stages may mean up to 32 subdivisions per curve segment. Increase with care! +"tolerance_degrees" controls how many degrees the midpoint of a segment may deviate from the real curve, before the segment has to be subdivided. @@ -8856,14 +8893,18 @@ + Describes a Bezier curve in 3D space. + This class describes a Bezier curve in 3D space. It is mainly used to give a shape to a [Path], but can be manually sampled for other purposes. +It keeps a cache of precalculated points along the curve, to speed further calculations up. + Returns the number of points describing the curve. @@ -8876,6 +8917,8 @@ + Adds a point to a curve, at position "pos", with control points "in" and "out". +If "atpos" is given, the point is inserted before the point number "atpos", moving that point (and every point after) after the inserted point. If "atpos" is not given, or is an illegal value (atpos <0 or atpos >= [method get_point_count]), the point will be appended at the end of the point list. @@ -8884,6 +8927,7 @@ + Sets the position for the vertex "idx". If the index is out of bounds, the function sends an error to the console. @@ -8892,6 +8936,7 @@ + Returns the position of the vertex "idx". If the index is out of bounds, the function sends an error to the console, and returns (0, 0, 0). @@ -8900,6 +8945,8 @@ + Sets the tilt angle in radians for the point "idx". If the index is out of bounds, the function sends an error to the console. +The tilt controls the rotation along the look-at axis an object travelling the path would have. In the case of a curve controlling a [PathFollow], this tilt is an offset over the natural tilt the PathFollow calculates. @@ -8908,6 +8955,7 @@ + Returns the tilt angle in radians for the point "idx". If the index is out of bounds, the function sends an error to the console, and returns 0. @@ -8916,6 +8964,7 @@ + Sets the position of the control point leading to the vertex "idx". If the index is out of bounds, the function sends an error to the console. @@ -8924,6 +8973,7 @@ + Returns the position of the control point leading to the vertex "idx". If the index is out of bounds, the function sends an error to the console, and returns (0, 0, 0). @@ -8932,6 +8982,7 @@ + Sets the position of the control point leading out of the vertex "idx". If the index is out of bounds, the function sends an error to the console. @@ -8940,12 +8991,14 @@ + Returns the position of the control point leading out of the vertex "idx". If the index is out of bounds, the function sends an error to the console, and returns (0, 0, 0). + Deletes the point "idx" from the curve. Sends an error to the console if "idx" is out of bounds. @@ -8956,6 +9009,8 @@ + Returns the position between the vertex "idx" and the vertex "idx"+1, where "t" controls if the point is the first vertex (t = 0.0), the last vertex (t = 1.0), or in between. Values of "t" outside the range (0.0 >= t <=1) give strange, but predictable results. +If "idx" is out of bounds it is truncated to the first or last vertex, and "t" is ignored. If the curve has no points, the function sends an error to the console, and returns (0, 0, 0). @@ -8964,24 +9019,28 @@ + Returns the position at the vertex "fofs". It calls [method interpolate] using the integer part of fofs as "idx", and its fractional part as "t". + Sets the distance in 3D units between two adjacent cached points. Changing it forces the cache to be recomputed the next time a xxx_baked_xxx function is called. The less distance, the more points the cache will have, and the more memory it will consume, so use with care. + Returns the distance between two adjacent cached points. + Returns the total length of the curve, based on the cached points. Given enough density (see [method set_bake_interval]), it should be approximate enough. @@ -8992,18 +9051,37 @@ + Returns a point within the curve at position "offset", where "offset" is measured as a distance in 3D units along the curve. +To do that, it finds the two cached points where the "offset" lies between, then interpolates the values. This interpolation is cubic if "cubic" is set to true, or linear if set to false. +Cubic interpolation tends to follow the curves better, but linear is faster (and often, precise enough). + Returns the cache of points as a [Vector3Array]. + Returns the cache of tilts as a [RealArray]. + + + + + + + + + + + Returns a list of points along the curve, with a curvature controlled point density. That is, the curvier parts will have more points than the straighter parts. +This approximation makes straight segments between each point, then subdivides those segments until the resulting shape is similar enough. +"max_stages" controls how many subdivisions a curve segment may face before it is considered approximate enough. Each subdivision splits the segment in half, so the default 5 stages may mean up to 32 subdivisions per curve segment. Increase with care! +"tolerance_degrees" controls how many degrees the midpoint of a segment may deviate from the real curve, before the segment has to be subdivided. @@ -21229,20 +21307,24 @@ + Container for a [Curve3D]. + This class is a container/Node-ification of a [Curve3D], so it can have [Spatial] properties and [Node] info. + Sets the [Curve3D]. + Returns the [Curve3D] contained. @@ -21251,20 +21333,24 @@ + Container for a [Curve2D]. + This class is a container/Node-ification of a [Curve2D], so it can have [Node2D] properties and [Node] info. + Sets the [Curve2D]. + Returns the [Curve2D] contained. @@ -21273,197 +21359,245 @@ + Point sampler for a [Path]. + This node takes its parent [Path], and returns the coordinates of a point within it, given a distance from the first vertex. +It is useful for making other nodes follow a path, without coding the movement pattern. For that, the nodes must be descendants of this node. Then, when setting an offset in this node, the descendant nodes will move accordingly. + Sets the distance from the first vertex, measured in 3D units along the path. This sets this node's position to a point within the path. + Returns the distance along the path in 3D units. + Moves this node in the X axis. As this node's position will be set every time its offset is set, this allows many PathFollow to share the same curve (and thus the same movement pattern), yet not return the same position for a given path offset. +A similar effect may be achieved moving the this node's descendants. + Returns the X displacement this node has from its parent [Path]. + Moves this node in the Y axis, for the same reasons of [method set_h_offset]. + Returns the Y displacement this node has from its parent [Path]. + Sets the distance from the first vertex, considering 0.0 as the first vertex and 1.0 as the last. This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length. + Returns the distance along the path as a number in the range 0.0 (for the first vertex) to 1.0 (for the last). + Allows or forbids rotation on one or more axes, per the constants below. + Returns the rotation mode. The constants below list which axes are allowed to rotate for each mode. + The points along the [Curve3D] of the [Path] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough. +There are two answers to this problem: Either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations. +This method controls whether the position between two cached points is interpolated linearly, or cubicly. + This method returns whether the position between two cached points (see [method set_cubic_interpolation]) is interpolated linearly, or cubicly. + If set, any offset outside the path's length (whether set by [method set_offset] or [method set_unit_offset] will wrap around, instead of stopping at the ends. Set it for cyclic paths. + Returns whether this node wraps its offsets around, or truncates them to the path ends. + Forbids the PathFollow to rotate. + Allows the PathFollow to rotate in the Y axis only. + Allows the PathFollow to rotate in both the X, and Y axes. + Allows the PathFollow to rotate in any axis. + Point sampler for a [Path2D]. + This node takes its parent [Path2D], and returns the coordinates of a point within it, given a distance from the first vertex. +It is useful for making other nodes follow a path, without coding the movement pattern. For that, the nodes must be descendants of this node. Then, when setting an offset in this node, the descendant nodes will move accordingly. + Sets the distance from the first vertex, measured in pixels along the path. This sets this node's position to a point within the path. + Returns the distance along the path in pixels. + Moves this node horizontally. As this node's position will be set every time its offset is set, this allows many PathFollow2D to share the same curve (and thus the same movement pattern), yet not return the same position for a given path offset. +A similar effect may be achieved moving this node's descendants. + Returns the horizontal displacement this node has from its parent [Path2D]. + Moves the PathFollow2D vertically, for the same reasons of [method set_h_offset]. + Returns the vertical displacement this node has from its parent [Path2D]. + Sets the distance from the first vertex, considering 0.0 as the first vertex and 1.0 as the last. This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length. + Returns the distance along the path as a number in the range 0.0 (for the first vertex) to 1.0 (for the last). + If set, this node rotates to follow the path, making its descendants rotate. + Returns whether this node rotates to follow the path. + The points along the [Curve2D] of the [Path2D] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough. +There are two answers to this problem: Either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations. +This method controls whether the position between two cached points is interpolated linearly, or cubicly. + This method returns whether the position between two cached points (see [method set_cubic_interpolation]) is interpolated linearly, or cubicly. + If set, any offset outside the path's length (whether set by [method set_offset] or [method set_unit_offset] will wrap around, instead of stopping at the ends. Set it for cyclic paths. + Returns whether this node wraps its offsets around, or truncates them to the path ends. + + + + -- cgit v1.2.3