summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorYaohua Xiong <xiongyaohua@gmail.com>2022-11-24 20:43:34 +0800
committerYaohua Xiong <xiongyaohua@gmail.com>2022-12-05 21:22:05 +0800
commit91e9ad92f5f78dd1578df46205f028599f095357 (patch)
treef13fa7ecddc68dc33d4bac4016f77184fd483169 /doc/classes
parent8912f3e4a7c012443e941f4c6f2342c9913fa330 (diff)
Refactor baking code for Curve2D
The main change is to caculate tangent directly from bezier curve, without going through discretized polyline, avoiding pitfalls of discretization. A similar refacor had been applied to Curve3D. The test cases for Curve2D is updated, comparing floating point with is_equal_approxmiate() instead of `==`, in order to avoid float precision problem.
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/@GlobalScope.xml4
-rw-r--r--doc/classes/Curve2D.xml16
-rw-r--r--doc/classes/Curve3D.xml4
-rw-r--r--doc/classes/Vector2.xml4
-rw-r--r--doc/classes/Vector3.xml4
5 files changed, 18 insertions, 14 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 977bcb78e9..4a6b85f229 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -115,7 +115,7 @@
<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.
+ Returns the derivative at the given [param t] on a one-dimensional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by the given [param control_1], [param control_2], and [param end] points.
</description>
</method>
<method name="bezier_interpolate">
@@ -126,7 +126,7 @@
<param index="3" name="end" type="float" />
<param index="4" name="t" type="float" />
<description>
- Returns the point 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.
+ Returns the point at the given [param t] on a one-dimensional [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by the given [param control_1], [param control_2], and [param end] points.
</description>
</method>
<method name="bytes_to_var">
diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml
index ccdf085319..b5e75dff68 100644
--- a/doc/classes/Curve2D.xml
+++ b/doc/classes/Curve2D.xml
@@ -51,7 +51,7 @@
<return type="Vector2" />
<param index="0" name="to_point" type="Vector2" />
<description>
- Returns the closest baked point (in curve's local space) to [param to_point].
+ Returns the closest point on baked segments (in curve's local space) to [param to_point].
[param to_point] must be in this curve's local space.
</description>
</method>
@@ -94,7 +94,7 @@
</method>
<method name="sample_baked" qualifiers="const">
<return type="Vector2" />
- <param index="0" name="offset" type="float" />
+ <param index="0" name="offset" type="float" default="0.0" />
<param index="1" name="cubic" type="bool" default="false" />
<description>
Returns a point within the curve at position [param offset], where [param offset] is measured as a pixel distance along the curve.
@@ -104,13 +104,10 @@
</method>
<method name="sample_baked_with_rotation" qualifiers="const">
<return type="Transform2D" />
- <param index="0" name="offset" type="float" />
+ <param index="0" name="offset" type="float" default="0.0" />
<param index="1" name="cubic" type="bool" default="false" />
- <param index="2" name="loop" type="bool" default="true" />
- <param index="3" name="lookahead" type="float" default="4.0" />
<description>
Similar to [method sample_baked], but returns [Transform2D] that includes a rotation along the curve. Returns empty transform if length of the curve is [code]0[/code].
- Use [param loop] to smooth the tangent at the end of the curve. [param lookahead] defines the distance to a nearby point for calculating the tangent vector.
[codeblock]
var transform = curve.sample_baked_with_rotation(offset)
position = transform.get_origin()
@@ -160,6 +157,13 @@
[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="PackedVector2Array" />
+ <param index="0" name="max_stages" type="int" default="5" />
+ <param index="1" name="tolerance_length" type="float" default="20.0" />
+ <description>
+ </description>
+ </method>
</methods>
<members>
<member name="bake_interval" type="float" setter="set_bake_interval" getter="get_bake_interval" default="5.0">
diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml
index 851996131f..cfe2036499 100644
--- a/doc/classes/Curve3D.xml
+++ b/doc/classes/Curve3D.xml
@@ -114,7 +114,7 @@
</method>
<method name="sample_baked" qualifiers="const">
<return type="Vector3" />
- <param index="0" name="offset" type="float" />
+ <param index="0" name="offset" type="float" default="0.0" />
<param index="1" name="cubic" type="bool" default="false" />
<description>
Returns a point within the curve at position [param offset], where [param offset] is measured as a distance in 3D units along the curve.
@@ -134,7 +134,7 @@
</method>
<method name="sample_baked_with_rotation" qualifiers="const">
<return type="Transform3D" />
- <param index="0" name="offset" type="float" />
+ <param index="0" name="offset" type="float" default="0.0" />
<param index="1" name="cubic" type="bool" default="false" />
<param index="2" name="apply_tilt" type="bool" default="false" />
<description>
diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml
index 4156030d77..1cd73688ee 100644
--- a/doc/classes/Vector2.xml
+++ b/doc/classes/Vector2.xml
@@ -93,7 +93,7 @@
<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.
+ Returns the derivative at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier 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">
@@ -103,7 +103,7 @@
<param index="2" name="end" type="Vector2" />
<param index="3" name="t" type="float" />
<description>
- Returns the point 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.
+ Returns the point at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points.
</description>
</method>
<method name="bounce" qualifiers="const">
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index 2896408505..1d7eda6bb9 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -69,7 +69,7 @@
<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.
+ Returns the derivative at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier 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">
@@ -79,7 +79,7 @@
<param index="2" name="end" type="Vector3" />
<param index="3" name="t" type="float" />
<description>
- Returns the point 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.
+ Returns the point at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points.
</description>
</method>
<method name="bounce" qualifiers="const">