Skip to content

Commit 1f98f8f

Browse files
committed
ensure the bezier path uses the same configuration
1 parent 259e03d commit 1f98f8f

4 files changed

Lines changed: 17 additions & 16 deletions

File tree

src/main/java/com/piro/bezier/BezierPath.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import eu.mihosoft.vrl.v3d.Edge;
1010
import eu.mihosoft.vrl.v3d.Extrude;
1111
import eu.mihosoft.vrl.v3d.Plane;
12+
import eu.mihosoft.vrl.v3d.TextExtrude;
1213
import eu.mihosoft.vrl.v3d.Vector3d;
1314
import eu.mihosoft.vrl.v3d.Vertex;
1415

@@ -21,12 +22,12 @@ public class BezierPath {
2122
BezierListProducer path;
2223

2324
private ArrayList<Vector3d> plInternal = new ArrayList<Vector3d>();
24-
private final int resolutionPoints;
25+
//private final int resolutionPoints;
2526

2627
/** Creates a new instance of Animate */
27-
public BezierPath(int resolution) {
28-
this.resolutionPoints = resolution;
29-
}
28+
// public BezierPath(int resolution) {
29+
// this.resolutionPoints = resolution;
30+
// }
3031

3132
public void parsePathString(String d) {
3233

@@ -175,7 +176,7 @@ private double getResolution() {
175176
if (dpoints < 1)
176177
dpoints = 1;
177178
double increment = 1.0 / dpoints;
178-
double min = 1.0 / ((double) resolutionPoints);
179+
double min = 1.0 / ((double) TextExtrude.getTextResolutionPoints());
179180
if (increment < min)
180181
increment = min;
181182
if (increment > MaximumInterpolationStep)

src/main/java/eu/mihosoft/vrl/v3d/Extrude.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,9 @@ public static ArrayList<Transform> pathToTransforms(List<List<Vector3d>> points,
399399
}
400400
// println "A string = " +pathStringA
401401
// println "B String = " +pathStringB
402-
BezierPath path = new BezierPath(10);
402+
BezierPath path = new BezierPath();
403403
path.parsePathString(pathStringA);
404-
BezierPath path2 = new BezierPath(10);
404+
BezierPath path2 = new BezierPath();
405405
path2.parsePathString(pathStringB);
406406

407407
return bezierToTransforms(path, path2, resolution, null, null);
@@ -414,10 +414,10 @@ public static ArrayList<CSG> moveAlongProfile(CSG object, List<List<Vector3d>> p
414414

415415
public static ArrayList<Transform> bezierToTransforms(Vector3d controlA, Vector3d controlB, Vector3d endPoint,
416416
int iterations) {
417-
BezierPath path = new BezierPath(10);
417+
BezierPath path = new BezierPath();
418418
path.parsePathString("C " + controlA.x + "," + controlA.y + " " + controlB.x + "," + controlB.y + " "
419419
+ endPoint.x + "," + endPoint.y);
420-
BezierPath path2 = new BezierPath(10);
420+
BezierPath path2 = new BezierPath();
421421
path2.parsePathString("C " + controlA.x + "," + controlA.z + " " + controlB.x + "," + controlB.z + " "
422422
+ endPoint.x + "," + endPoint.z);
423423

@@ -561,9 +561,9 @@ public static ArrayList<Transform> bezierToTransforms(Vector3d start, Vector3d c
561561
String b = "M " + start.x + "," + start.z + "\n" + "C " + controlA.x + "," + controlA.z + " " + controlB.x + ","
562562
+ controlB.z + " " + endPoint.x + "," + endPoint.z;
563563
// println "Start = "+startString
564-
BezierPath path = new BezierPath(10);
564+
BezierPath path = new BezierPath();
565565
path.parsePathString(startString);
566-
BezierPath path2 = new BezierPath(10);
566+
BezierPath path2 = new BezierPath();
567567
path2.parsePathString(b);
568568
// newParts.remove(parts.size()-1)
569569
// newParts.remove(0)
@@ -781,7 +781,7 @@ private static Vector3d fromDouble(ArrayList<Double> controlA) {
781781
public static ArrayList<CSG> moveBezier(CSG slice, BezierPath pathA, int numSlices) {
782782
Vector3d pointA = pathA.eval((double) 1.0);
783783
String zpath = "C 0,0 " + pointA.x + "," + pointA.y + " " + pointA.x + "," + pointA.y;
784-
BezierPath pathB = new BezierPath(10);
784+
BezierPath pathB = new BezierPath();
785785
pathB.parsePathString(zpath);
786786

787787
return moveBezier(slice, pathA, pathB, numSlices);

src/main/java/eu/mihosoft/vrl/v3d/TextExtrude.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ private static List<List<Vector3d>> extractRawOutlines(Path textPath) {
243243
if (element instanceof MoveTo) {
244244
// If we have a current path, process it with BezierPath
245245
if (pathBuilder.length() > 0) {
246-
BezierPath bezierPath = new BezierPath(getTextResolutionPoints());
246+
BezierPath bezierPath = new BezierPath();
247247
bezierPath.parsePathString(pathBuilder.toString());
248248
List<Vector3d> pathPoints = bezierPath.evaluate();
249249
if (!pathPoints.isEmpty()) {
250-
allOutlines.add(new ArrayList<>(pathPoints));
250+
allOutlines.add(new ArrayList<Vector3d>(pathPoints));
251251
}
252252
pathBuilder = new StringBuilder();
253253
}
@@ -274,7 +274,7 @@ private static List<List<Vector3d>> extractRawOutlines(Path textPath) {
274274

275275
// Process the final path if it exists
276276
if (pathBuilder.length() > 0) {
277-
BezierPath bezierPath = new BezierPath(5);
277+
BezierPath bezierPath = new BezierPath();
278278
bezierPath.parsePathString(pathBuilder.toString());
279279
List<Vector3d> pathPoints = bezierPath.evaluate();
280280
if (!pathPoints.isEmpty()) {

src/main/java/eu/mihosoft/vrl/v3d/svg/SVGLoad.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ private void loadSingle(String code, Transform startingFrame, String encapsulati
647647
if (encapsulatingLayer == null)
648648
throw new RuntimeException("Layer Name can not be null");
649649
// println code
650-
BezierPath path = new BezierPath(TextExtrude.getTextResolutionPoints());
650+
BezierPath path = new BezierPath();
651651
path.parsePathString(code);
652652

653653
ArrayList<Vector3d> p = path.evaluate();

0 commit comments

Comments
 (0)