mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 19:29:06 +00:00
Draft: Remove "simple", "simply", "easy", and "just" from the docs (#4496)
* Various style edits * Edit out "simple" when possible Co-authored-by: Max Hilbrunner <mhilbrunner@users.noreply.github.com> Co-authored-by: Clay John <claynjohn@gmail.com>
This commit is contained in:
co-authored by
Max Hilbrunner
Clay John
parent
a4a368af15
commit
bd19917ea0
@@ -151,9 +151,9 @@ Using them, however, may not be completely obvious, so following is a descriptio
|
||||
Evaluating
|
||||
----------
|
||||
|
||||
Just evaluating them may be an option, but in most cases it's not very useful. The big drawback with Bezier curves is that if you traverse them at constant speed, from ``t = 0`` to ``t = 1``, the actual interpolation will *not* move at constant speed. The speed is also an interpolation between the distances between points ``p0``, ``p1``, ``p2`` and ``p3`` and there is not a mathematically simple way to traverse the curve at constant speed.
|
||||
Only evaluating them may be an option, but in most cases it's not very useful. The big drawback with Bezier curves is that if you traverse them at constant speed, from ``t = 0`` to ``t = 1``, the actual interpolation will *not* move at constant speed. The speed is also an interpolation between the distances between points ``p0``, ``p1``, ``p2`` and ``p3`` and there is not a mathematically simple way to traverse the curve at constant speed.
|
||||
|
||||
Let's do a simple example with the following pseudocode:
|
||||
Let's do an example with the following pseudocode:
|
||||
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
@@ -7,9 +7,9 @@ Interpolation is a very basic operation in graphics programming. It's good to be
|
||||
|
||||
The basic idea is that you want to transition from A to B. A value ``t``, represents the states in-between.
|
||||
|
||||
As an example if ``t`` is 0, then the state is A. If ``t`` is 1, then the state is B. Anything in-between is an *interpolation*.
|
||||
For example, if ``t`` is 0, then the state is A. If ``t`` is 1, then the state is B. Anything in-between is an *interpolation*.
|
||||
|
||||
Between two real (floating-point) numbers, a simple interpolation is usually described as:
|
||||
Between two real (floating-point) numbers, an interpolation can be described as:
|
||||
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
@@ -23,7 +23,7 @@ And often simplified to:
|
||||
|
||||
interpolation = A + (B - A) * t
|
||||
|
||||
The name of this type of interpolation, which transforms a value into another at *constant speed* is *"linear"*. So, when you hear about *Linear Interpolation*, you know they are referring to this simple formula.
|
||||
The name of this type of interpolation, which transforms a value into another at *constant speed* is *"linear"*. So, when you hear about *Linear Interpolation*, you know they are referring to this formula.
|
||||
|
||||
There are other types of interpolations, which will not be covered here. A recommended read afterwards is the :ref:`Bezier <doc_beziers_and_curves>` page.
|
||||
|
||||
@@ -35,7 +35,7 @@ Vector types (:ref:`Vector2 <class_Vector2>` and :ref:`Vector3 <class_Vector3>`)
|
||||
|
||||
For cubic interpolation, there are also :ref:`Vector2.cubic_interpolate() <class_Vector2_method_linear_interpolate>` and :ref:`Vector3.cubic_interpolate() <class_Vector3_method_linear_interpolate>`, which do a :ref:`Bezier <doc_beziers_and_curves>` style interpolation.
|
||||
|
||||
Here is simple pseudo-code for going from point A to B using interpolation:
|
||||
Here is example pseudo-code for going from point A to B using interpolation:
|
||||
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
@@ -235,7 +235,7 @@ Putting it all together
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
We're going to apply everything we mentioned so far onto one transform.
|
||||
To follow along, create a simple project with a Sprite node and use the
|
||||
To follow along, create a project with a Sprite node and use the
|
||||
Godot logo for the texture resource.
|
||||
|
||||
Let's set the translation to (350, 150), rotate by -0.5 rad, and scale by 3.
|
||||
|
||||
@@ -21,7 +21,7 @@ planes, 3D geometry (to determine where each face or vertex is siding),
|
||||
etc. A **normal** *is* a **unit vector**, but it's called *normal*
|
||||
because of its usage. (Just like we call (0,0) the Origin!).
|
||||
|
||||
It's as simple as it looks. The plane passes by the origin and the
|
||||
The plane passes by the origin and the
|
||||
surface of it is perpendicular to the unit vector (or *normal*). The
|
||||
side towards the vector points to is the positive half-space, while the
|
||||
other side is the negative half-space. In 3D this is exactly the same,
|
||||
@@ -130,8 +130,8 @@ inverted negative and positive half spaces:
|
||||
N = -N;
|
||||
D = -D;
|
||||
|
||||
Of course, Godot also implements this operator in :ref:`Plane <class_Plane>`,
|
||||
so doing:
|
||||
Godot also implements this operator in :ref:`Plane <class_Plane>`.
|
||||
So, using the format below will work as expected:
|
||||
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
@@ -142,12 +142,9 @@ so doing:
|
||||
|
||||
var invertedPlane = -plane;
|
||||
|
||||
Will work as expected.
|
||||
|
||||
So, remember, a plane is just that and its main practical use is
|
||||
calculating the distance to it. So, why is it useful to calculate the
|
||||
distance from a point to a plane? It's extremely useful! Let's see some
|
||||
simple examples..
|
||||
So, remember, the plane's main practical use is that we can
|
||||
calculate the distance to it. So, when is it useful to calculate the
|
||||
distance from a point to a plane? Let's see some examples.
|
||||
|
||||
Constructing a plane in 2D
|
||||
--------------------------
|
||||
@@ -157,7 +154,7 @@ Constructing them in 2D is easy, this can be done from either a normal
|
||||
(unit vector) and a point, or from two points in space.
|
||||
|
||||
In the case of a normal and a point, most of the work is done, as the
|
||||
normal is already computed, so just calculate D from the dot product of
|
||||
normal is already computed, so calculate D from the dot product of
|
||||
the normal and the point.
|
||||
|
||||
.. tabs::
|
||||
@@ -196,8 +193,8 @@ degrees to either side:
|
||||
// Alternatively (depending the desired side of the normal):
|
||||
// var normal = new Vector2(-dvec.y, dvec.x);
|
||||
|
||||
The rest is the same as the previous example, either point_a or
|
||||
point_b will work since they are in the same plane:
|
||||
The rest is the same as the previous example. Either point_a or
|
||||
point_b will work, as they are in the same plane:
|
||||
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
@@ -214,13 +211,13 @@ point_b will work since they are in the same plane:
|
||||
// this works the same
|
||||
// var D = normal.Dot(pointB);
|
||||
|
||||
Doing the same in 3D is a little more complex and will be explained
|
||||
Doing the same in 3D is a little more complex and is explained
|
||||
further down.
|
||||
|
||||
Some examples of planes
|
||||
-----------------------
|
||||
|
||||
Here is a simple example of what planes are useful for. Imagine you have
|
||||
Here is an example of what planes are useful for. Imagine you have
|
||||
a `convex <https://www.mathsisfun.com/definitions/convex.html>`__
|
||||
polygon. For example, a rectangle, a trapezoid, a triangle, or just any
|
||||
polygon where no faces bend inwards.
|
||||
|
||||
Reference in New Issue
Block a user