Graphics Reference
In-Depth Information
where
x v +
y v
z v
x t +
y t
z t
A
=
B
=
2x t x v +
2y t y v
2z t z v
C
=
This reduces to
2
2
2
y v z v
y t z t
z v x v
z t x t
x v y v
x t y t
x t x v +
y t y v
z t z v
±
+
=
(6.27)
x v +
y v
z v
The value of the discriminant of Eq. (6.27) determines whether the line intersects, is tangential,
or misses the cone:
Miss condition
2
2
2
y v z v
y t z t
z v x v
z t x t
x v y v
x t y t
+
< 0
Tangential condition
2
2
2
y v z v
y t z t
z v
x v
x v y v
x t y t
+
=
0
z t
x t
Intersect condition
2
2
2
y v z v
y t z t
z v x v
z t x t
x v y v
x t y t
+
> 0
If the denominator of Eq. (6.27) is zero, the ray is parallel with the cone's side.
Limits to the cone's length can be set using the same technique for the cylinder, where z min
and z max define the z-extent of the cone. These can be negative or positive and determine
whether the cone is aligned with the negative or positive z-axis, respectively.
If the ray intersects the cone twice, there will be two values of : 1 and 2 , which generate
the two z coordinates of the intersections:
z 1 =
z t +
1 z v
z 2 =
z t +
2 z v
Once again, to ensure that the intersections occur in the isolated part of the cone, we test for
z min < z 1 z 2 <z max
By making either z min or z max equal to zero retains the cone's apex. However, if they are both
negative or both positive, a truncated cone is created. And if the cone requires end caps, the
same technique used for capping cylinders can be applied to cones.
 
Search WWH ::




Custom Search