Skip to content

Commit

Permalink
Added interpolation for same-complexity polylines
Browse files Browse the repository at this point in the history
  • Loading branch information
Meulemans committed Mar 4, 2020
1 parent 96355c3 commit a3ae5d3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/nl/tue/geometrycore/interpolation/Interpolator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import nl.tue.geometrycore.geometry.Vector;
import nl.tue.geometrycore.geometry.curved.Circle;
import nl.tue.geometrycore.geometry.linear.LineSegment;
import nl.tue.geometrycore.geometry.linear.PolyLine;
import nl.tue.geometrycore.geometry.linear.Polygon;
import nl.tue.geometrycore.geometry.linear.Rectangle;
import nl.tue.geometrycore.interpolation.ease.LinearEasing;
Expand Down Expand Up @@ -101,6 +102,23 @@ public Polygon between(double fraction, Polygon a, Polygon b) {
return p;

}

/**
* Assumes same number of vertices.
*
* @param fraction
* @param a
* @param b
* @return
*/
public PolyLine between(double fraction, PolyLine a, PolyLine b) {
PolyLine p = new PolyLine();
for (int i = 0; i < a.vertexCount(); i++) {
p.addVertex(between(fraction, a.vertex(i), b.vertex(i)));
}
return p;

}

public <T extends BaseGeometry> T scale(double fraction, T geom, double scale, Vector scaleOrigin) {
T result = (T) geom.clone();
Expand Down

0 comments on commit a3ae5d3

Please sign in to comment.