mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 17:04:42 -04:00
improved scaling of quadratic bezier curves
This commit is contained in:
parent
17d712b5f8
commit
130aab48de
@ -313,8 +313,9 @@ public class Polygon implements Iterable<Polygon.PathElement> {
|
||||
* @param v the visitor to use
|
||||
*/
|
||||
public void traverse(PointVisitor v) {
|
||||
VectorInterface start = null;
|
||||
for (PathElement pe : path)
|
||||
pe.traverse(v);
|
||||
start = pe.traverse(start, v);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -356,9 +357,11 @@ public class Polygon implements Iterable<Polygon.PathElement> {
|
||||
/**
|
||||
* Traverses all points
|
||||
*
|
||||
* @param v the visitor to use
|
||||
* @param start the start point
|
||||
* @param v the visitor to use
|
||||
* @return the end point
|
||||
*/
|
||||
void traverse(PointVisitor v);
|
||||
VectorInterface traverse(VectorInterface start, PointVisitor v);
|
||||
}
|
||||
|
||||
private static String str(float f) {
|
||||
@ -406,8 +409,9 @@ public class Polygon implements Iterable<Polygon.PathElement> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void traverse(PointVisitor v) {
|
||||
public VectorInterface traverse(VectorInterface start, PointVisitor v) {
|
||||
v.visit(p);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
//CHECKSTYLE.ON: FinalClass
|
||||
@ -471,10 +475,11 @@ public class Polygon implements Iterable<Polygon.PathElement> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void traverse(PointVisitor v) {
|
||||
public VectorInterface traverse(VectorInterface start, PointVisitor v) {
|
||||
v.visit(c1);
|
||||
v.visit(c2);
|
||||
v.visit(p);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
@ -512,9 +517,11 @@ public class Polygon implements Iterable<Polygon.PathElement> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void traverse(PointVisitor v) {
|
||||
v.visit(c);
|
||||
public VectorInterface traverse(VectorInterface start, PointVisitor v) {
|
||||
VectorInterface p1s = c.div(2);
|
||||
v.visit(start.div(2).add(p1s).add(p.div(2).add(p1s)).div(2));
|
||||
v.visit(p);
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
@ -540,7 +547,8 @@ public class Polygon implements Iterable<Polygon.PathElement> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void traverse(PointVisitor v) {
|
||||
public VectorInterface traverse(VectorInterface start, PointVisitor v) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user