Anonymous user
Determine if two triangles overlap: Difference between revisions
m
→{{header|Lambdatalk}}: minor edit
m (corrected a misspelling.) |
m (→{{header|Lambdatalk}}: minor edit) |
||
Line 1,903:
1) isInside
PA^PB, PB^PC and PC^PA are of equal sign.
{def isInside
{lambda {
{let { {
{
{
{
} {let { {:w1 {- {* {- :px :ax} {- :cy :ay}}
} {or {and {>= :w1 0} {>= :w2 0} {>= :w3 0}}
-> isInside
2) overlapping
{def overlap
Line 1,927 ⟶ 1,931:
{def overlap.row
{lambda {:p0 :p1 :p2 :q0 :q1 :q2 :w :h :y}
{S.map {{lambda {:p0 :p1 :p2 :q0 :q1 :q2 :qp}
{
then x else}} :p0 :p1
▲ then x else}} :p0 :p1 :p2 :q0 :q1 :q2}
{S.map {{lambda {:y :x} {cons :x :y}} :y}
{S.serie :w :h} }}}}
Line 1,940 ⟶ 1,943:
-> overlap
Given coordonnees will just be
▲If the number of shared points is zero, triangles don't overlap.
{overlap {cons 0 0} {cons 50 0} {cons 0 50}
|