Graphics Reference
In-Depth Information
If ORIENT2D(
A
,
B
,
C
)
0,
C
lies to the left of the directed line
AB
. Equivalently,
the triangle
ABC
is oriented counterclockwise. When ORIENT2D(
A
,
B
,
C
)
>
0,
C
lies to the right of the directed line
AB
, and the triangle
ABC
is oriented clock-
wise. When ORIENT2D(
A
,
B
,
C
)
<
0, the three points are collinear. The actual value
returned by ORIENT2D(
A
,
B
,
C
) corresponds to twice the signed area of the trian-
gle
ABC
(positive if
ABC
is counterclockwise, otherwise negative). Alternatively, this
determinant can be seen as the implicit equation of the 2D line
L
(
x
,
y
)
=
=
0 through
the points
A
=
(
a
x
,
a
y
) and
B
=
(
b
x
,
b
y
) by defining
L
(
x
,
y
)as
a
x
a
y
1
b
x
b
y
1
xy
1
L
(
x
,
y
)
=
.
3.1.6.2 ORIENT3D(
A
,
B
,
C
,
D
)
=
=
=
=
Given four 3D points
A
(
a
x
,
a
y
,
a
z
),
B
(
b
x
,
b
y
,
b
z
),
C
(
c
x
,
c
y
,
c
z
), and
D
(
d
x
,
d
y
,
d
z
), define ORIENT3D(
A
,
B
,
C
,
D
)as
a
x
a
y
a
z
1
a
x
−
d
x
a
y
−
d
y
a
z
−
d
z
b
x
b
y
b
z
1
b
x
−
d
x
b
y
−
d
y
b
z
−
d
z
ORIENT3D(
A
,
B
,
C
,
D
)
=
=
c
x
c
y
c
z
1
c
x
−
d
x
c
y
−
d
y
c
z
−
d
z
d
x
d
y
d
z
1
=
(
A
−
D
)
·
((
B
−
D
)
×
(
C
−
D
)).
When ORIENT3D(
A
,
B
,
C
,
D
)
0,
D
lies above the supporting plane of trian-
gle
ABC
, in the sense that
ABC
appears in counterclockwise order when viewed
from
D
. If ORIENT3D(
A
,
B
,
C
,
D
)
<
>
0,
D
instead lies below the plane of
ABC
. When
ORIENT3D(
A
,
B
,
C
,
D
)
0, the four points are coplanar. The value returned by
ORIENT3D(
A
,
B
,
C
,
D
) corresponds to six times the signed volume of the tetrahe-
dron formed by the four points. Alternatively, the determinant can be seen as the
implicit equation of the 3D plane
P
(
x
,
y
,
z
)
=
=
0 through the points
A
=
(
a
x
,
a
y
,
a
z
),
B
=
(
b
x
,
b
y
,
b
z
), and
C
=
(
c
x
,
c
y
,
c
z
) by defining
P
(
x
,
y
,
z
)as
a
x
a
y
a
z
1
b
x
b
y
b
z
1
c
x
c
y
c
z
1
xyz
1
P(
x
,
y
,
z
)
=
.