Edge/Triangle intersection P02

Alex Scarlata

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

Source code: actions UI colors geo2D main polygon
Files: p02.zip

Built with Processing

This application test the intersection points of a line segment and a triangle.
It highlights the intersecions of the edges with orange and overlaps with the polygon
in red. the points can be draged by clicking and draging near the point that you want
to move.

The intersection is dectected by checking to see if the normal of the segment agrees with
or disagrees with both of the vectors from one of the points of the segment to the points
of the triangle. if a intersection is dected it calcules the point of intersection and fills
in that point.

To check for singularities the program normalises the intersecting vectors and takes their
dot product. it then matches this number against a number thats near one that gives the error
tolerence. If the tollerence is acceptiable the program reconises it as a singualrarty. for the
singualiaty of overlaping the program takes the dotproducts of all four points against the
same vector and finds out which points are in the middle and draws and orange line between them.