mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
common: fix arg name
For Bezier curves, we typically use 't' as a parameter within the 0-1 range, while 'at' is used for the parameter scaled by the curve's length. In one of the functions, an incorrect name was used, which could be confusing. No logical changes.
This commit is contained in:
parent
4b73a074c4
commit
eca0011846
2 changed files with 14 additions and 14 deletions
|
@ -273,27 +273,27 @@ float Bezier::lengthApprox() const
|
|||
}
|
||||
|
||||
|
||||
void Bezier::split(float at, Bezier& left)
|
||||
void Bezier::split(float t, Bezier& left)
|
||||
{
|
||||
left.start = start;
|
||||
|
||||
left.ctrl1.x = start.x + at * (ctrl1.x - start.x);
|
||||
left.ctrl1.y = start.y + at * (ctrl1.y - start.y);
|
||||
left.ctrl1.x = start.x + t * (ctrl1.x - start.x);
|
||||
left.ctrl1.y = start.y + t * (ctrl1.y - start.y);
|
||||
|
||||
left.ctrl2.x = ctrl1.x + at * (ctrl2.x - ctrl1.x); //temporary holding spot
|
||||
left.ctrl2.y = ctrl1.y + at * (ctrl2.y - ctrl1.y); //temporary holding spot
|
||||
left.ctrl2.x = ctrl1.x + t * (ctrl2.x - ctrl1.x); //temporary holding spot
|
||||
left.ctrl2.y = ctrl1.y + t * (ctrl2.y - ctrl1.y); //temporary holding spot
|
||||
|
||||
ctrl2.x = ctrl2.x + at * (end.x - ctrl2.x);
|
||||
ctrl2.y = ctrl2.y + at * (end.y - ctrl2.y);
|
||||
ctrl2.x = ctrl2.x + t * (end.x - ctrl2.x);
|
||||
ctrl2.y = ctrl2.y + t * (end.y - ctrl2.y);
|
||||
|
||||
ctrl1.x = left.ctrl2.x + at * (ctrl2.x - left.ctrl2.x);
|
||||
ctrl1.y = left.ctrl2.y + at * (ctrl2.y - left.ctrl2.y);
|
||||
ctrl1.x = left.ctrl2.x + t * (ctrl2.x - left.ctrl2.x);
|
||||
ctrl1.y = left.ctrl2.y + t * (ctrl2.y - left.ctrl2.y);
|
||||
|
||||
left.ctrl2.x = left.ctrl1.x + at * (left.ctrl2.x - left.ctrl1.x);
|
||||
left.ctrl2.y = left.ctrl1.y + at * (left.ctrl2.y - left.ctrl1.y);
|
||||
left.ctrl2.x = left.ctrl1.x + t * (left.ctrl2.x - left.ctrl1.x);
|
||||
left.ctrl2.y = left.ctrl1.y + t * (left.ctrl2.y - left.ctrl1.y);
|
||||
|
||||
left.end.x = start.x = left.ctrl2.x + at * (ctrl1.x - left.ctrl2.x);
|
||||
left.end.y = start.y = left.ctrl2.y + at * (ctrl1.y - left.ctrl2.y);
|
||||
left.end.x = start.x = left.ctrl2.x + t * (ctrl1.x - left.ctrl2.x);
|
||||
left.end.y = start.y = left.ctrl2.y + t * (ctrl1.y - left.ctrl2.y);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -264,7 +264,7 @@ struct Bezier
|
|||
Point ctrl2;
|
||||
Point end;
|
||||
|
||||
void split(float at, Bezier& left);
|
||||
void split(float t, Bezier& left);
|
||||
void split(Bezier& left, Bezier& right) const;
|
||||
void split(float at, Bezier& left, Bezier& right) const;
|
||||
float length() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue