Sg2.9
Why isn't intersection working?
Recent RSS
Why isn't intersection working?
From:  JamesWlf
Date:  10. November 2013, 18:55

Hi.

I solved my other problem fast. I'm writing a tool with some resemblance to Jonathan Puckey's Delaunay Triangulation tool. Mine creates triangles or polygons by setting the vertices with mouse clicks, then colors them either with random colors or with colors from a sample image.

All is fine, but I need to find the intersections of a path with another shape, and I can't get them. I went back to check the examples in the tutorials, and realized the first intersection example (which may be closer to what I need, since I invoke an intersection test after each mouse down event) DOESN'T WORK! Duh.

The one with the mouse works (it uses mouse drag) and is the one I had checked, but I can't see the difference that makes the first doesn't work.

Here is the code of the example. I don't have my code at hand right now:

// Create two overlapping paths:
var square = new Path.Rectangle(new Point(0, 0), new Size(50, 50));
var circle = new Path.Circle(square.bounds.bottomRight, 25);

// Find the intersection locations between the paths:
var locations = square.getIntersections(circle);
print(locations.length) //Prints "0".
// Loop through the locations (if any):
for(var i = 0; i < locations.length; i++) {

// The position of the intersection:
var point = locations[i].point;

// Create a circle shaped path at the
// position of the intersection:
var path = new Path.Circle(point, 2); //Of course no circles are created.
path.fillColor = 'red';
}

Please, help. :(

Re: Why isn't intersection working?
From:  jameswlf
Date:  17. November 2013, 21:06

Please, help. :((((

Re: Why isn't intersection working?
From:  jameswlf
Date:  19. November 2013, 06:17

I solved my problem. yay!

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Stroke Translation 10.03.09