summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorYaohua Xiong <xiongyaohua@gmail.com>2022-11-23 11:11:58 +0800
committerYaohua Xiong <xiongyaohua@gmail.com>2022-11-24 10:52:06 +0800
commitf9fa182abc5209671cb4fbadc2dc173157d6f939 (patch)
treee7c3eac0ac1bed62fcaacd680f4f266f51df71b8 /doc/classes
parentfa270c2456df5ad12f51584c4ff891e2cf728cec (diff)
Refactor Curve3D::_bake() method
The main change is to caculate tangent directly from bezier curve, without going through discretized polyline, avoiding pitfalls of discretization. Other changes are: 1. Add an bezier_derivative() method for Vector3, Vector2, and Math; 2. Add an tesselate_even_length() method to Curve3D, which tesselate bezier curve to even length segments adaptively; 3. Cache the tangent vectors in baked_tangent_vector_cache;
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/@GlobalScope.xml11
-rw-r--r--doc/classes/Curve3D.xml9
-rw-r--r--doc/classes/Vector2.xml10
-rw-r--r--doc/classes/Vector3.xml10
4 files changed, 40 insertions, 0 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 34f706b6f9..a85532dba6 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -106,6 +106,17 @@
[/codeblock]
</description>
</method>
+ <method name="bezier_derivative">
+ <return type="float" />
+ <param index="0" name="start" type="float" />
+ <param index="1" name="control_1" type="float" />
+ <param index="2" name="control_2" type="float" />
+ <param index="3" name="end" type="float" />
+ <param index="4" name="t" type="float" />
+ <description>
+ Returns the derivative at the given [param t] on a one-dimensional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by the given [param control_1], [param control_2], and [param end] points.
+ </description>
+ </method>
<method name="bezier_interpolate">
<return type="float" />
<param index="0" name="start" type="float" />
diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml
index 63134417b1..67e4e45e52 100644
--- a/doc/classes/Curve3D.xml
+++ b/doc/classes/Curve3D.xml
@@ -192,6 +192,15 @@
[param tolerance_degrees] controls how many degrees the midpoint of a segment may deviate from the real curve, before the segment has to be subdivided.
</description>
</method>
+ <method name="tessellate_even_length" qualifiers="const">
+ <return type="PackedVector3Array" />
+ <param index="0" name="max_stages" type="int" default="5" />
+ <param index="1" name="tolerance_length" type="float" default="0.2" />
+ <description>
+ Returns a list of points along the curve, with almost uniform density. [param 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!
+ [param tolerance_length] controls the maximal distance between two neighbouring points, before the segment has to be subdivided.
+ </description>
+ </method>
</methods>
<members>
<member name="bake_interval" type="float" setter="set_bake_interval" getter="get_bake_interval" default="0.2">
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index eb83eb9aa6..fac672c764 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -86,6 +86,16 @@
Returns the aspect ratio of this vector, the ratio of [member x] to [member y].
</description>
</method>
+ <method name="bezier_derivative" qualifiers="const">
+ <return type="Vector2" />
+ <param index="0" name="control_1" type="Vector2" />
+ <param index="1" name="control_2" type="Vector2" />
+ <param index="2" name="end" type="Vector2" />
+ <param index="3" name="t" type="float" />
+ <description>
+ Returns the derivative at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points.
+ </description>
+ </method>
<method name="bezier_interpolate" qualifiers="const">
<return type="Vector2" />
<param index="0" name="control_1" type="Vector2" />
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index 9005dd3f0c..f075915a9c 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -62,6 +62,16 @@
Returns the unsigned minimum angle to the given vector, in radians.
</description>
</method>
+ <method name="bezier_derivative" qualifiers="const">
+ <return type="Vector3" />
+ <param index="0" name="control_1" type="Vector3" />
+ <param index="1" name="control_2" type="Vector3" />
+ <param index="2" name="end" type="Vector3" />
+ <param index="3" name="t" type="float" />
+ <description>
+ Returns the derivative at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bezier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points.
+ </description>
+ </method>
<method name="bezier_interpolate" qualifiers="const">
<return type="Vector3" />
<param index="0" name="control_1" type="Vector3" />