Pull out debug iteration steps from DrawCubicBezierCurve
This commit is contained in:
26
src/JGL.cpp
26
src/JGL.cpp
@@ -507,26 +507,18 @@ namespace JGL {
|
||||
const J3ML::LinearAlgebra::Vector2 &controlB, int subdivisions, float thickness) {
|
||||
|
||||
|
||||
|
||||
|
||||
for (int k = 2; k < subdivisions; ++k)
|
||||
Vector2 last = controlA;
|
||||
Vector2 first = controlB;
|
||||
for (int i = 0; i < subdivisions; ++i)
|
||||
{
|
||||
Vector2 last = controlA;
|
||||
Vector2 first = controlB;
|
||||
for (int i = 0; i < k; ++i)
|
||||
{
|
||||
float alpha = (float)i / (float)k;
|
||||
Vector2 step = J3ML::Algorithm::Bezier(alpha, controlA, pointA, pointB, controlB);
|
||||
DrawLine(color, last, step, thickness);
|
||||
last = step;
|
||||
}
|
||||
|
||||
// Manually draw the last segment of the curve
|
||||
DrawLine(color, last, first, thickness);
|
||||
|
||||
|
||||
float alpha = (float)i / (float)subdivisions;
|
||||
Vector2 step = J3ML::Algorithm::Bezier(alpha, controlA, pointA, pointB, controlB);
|
||||
DrawLine(color, last, step, thickness);
|
||||
last = step;
|
||||
}
|
||||
|
||||
// Have to manually draw the last segment of the curve.
|
||||
DrawLine(color, last, first, thickness);
|
||||
|
||||
// Display control points
|
||||
DrawPoint(Colors::Red, controlA, 2.f);
|
||||
|
Reference in New Issue
Block a user