The POV-Ray Cyclopedia

Bill DeWitt (bdewitt@gateway.net) asked for more information about vrotate and other vector expressions.

play ground Step 1
Creating the scene
Okay, this one is short and sweet:
#declare p1 = <-2,-1,-2>;
#declare p2 = <1,2,2>;

cylinder { p1,p2 0.1 texture { Cyan_Plastic } }

//sphere { 0, 1 pigment { rgbf 0.75 } finish { phong 0.5 } }

#declare p3 = vnormalize(p2-p1);
#declare p4 = vnormalize(p1-p2);

cylinder { 0, p3 0.1 texture { Yellow_Plastic } }
cylinder { 0, p4 0.1 texture { Purple_Plastic } }
The cyan cylinder joins p1 and p2. The yellow and purple cylinders are parallel to the cyan cylinder, and they both have a unit length of one.
pitfall Step 2
Avoiding pitfalls
There is one pitfall:
#declare p3 = vnormalize(p2);
#declare p4 = vnormalize(p1);

cylinder { 0, p3 0.1 texture { Yellow_Plastic } }
cylinder { 0, p4 0.1 texture { Purple_Plastic } }
Here the yellow and purple cylinders point to the ends ot the cylinder, and they are not parallel, but they maintain the length of 1.
Send feedback, or head back to the Cyclopedia.

Thanks for watching.