Closed golanlevin closed 4 years ago
Added: 30b8a65ea232aace30edcd0945e17b552de2bb53
hatchAngle(AUTO);
hatchAngleDeg(AUTO);
@golanlevin I'm using your rotated bounding box Processing code. However it seems that the code produces all NaN's when the input shape is symetric. For example, a simple rect centered in the middle causes matrix2x2[0][1]
to be zero, and thus triggering zero division in calcEigenvector making everybody NaN's. My current hack is to add a tiny random offset to every vertex before running the algorithm, which seems to be working fine.
My current hack is to add a tiny random offset to every vertex
Yikes 😬 Well, if it works.... Even so, maybe put in a check for NaNs?
Hi @LingDong- , currently, the AUTO orientation is incorrect — it should be perpendicular to the major axis, not parallel. Here is a test shape:
E.beginShape(); E.vertex(100, 100); E.vertex(160, 110); E.vertex(250, 170); E.vertex(300, 250); E.vertex(330, 290); E.vertex(280, 290); E.vertex(150, 180); E.endShape(CLOSE);
@golanlevin
hmm that could be a problem with the orientation calculation code you gave me.
My test:
E.ellipse(100,100,mouseX-100,mouseY-100);
which produces the correct result.
Looks like the number returned is either correct, or at 90° with the correct answer. Wonder what hack I should apply.
Ugly hack: compute the orientation; fit the oriented bounding box; take the max of width & height ?
@golanlevin you're right, this is fixed by fixing #74 :)
Sorry about that. Glad that I haven't wasted time on making a hack
I also added a hatchAngle(AUTO) example: 37017ec10c149c83506b1cd9a8c67d51e9384fd5
Awesome.
The orientation of parallel or satin strokes should be perpendicular to major axis of an arbitrary polygon, using hatchMode(AUTO).