|
|
Thanks - I found that, and indeed it has some good stuff in there.
Some of it's a bit cryptic, but I'm working through it.
It's a bit rough going.
It can be challenging to keep the syntax, math, geometry, and POV-Ray's
interpretation of a "Vector" all straight.
Still working on the sphere in contact with the 3 points of a triangle and a 4th
point... Can't seem to get it to work out.
#declare Corner_A_1 = <0, 0, 0>;
#declare Corner_A_2 = <4, 0, 0>;
#declare Corner_A_3 = <4, 4, 0>;
#declare H = 1;
#declare Circumscribed = object {Circumscribe (Corner_A_1, Corner_A_2,
Corner_A_3)};
#macro Circumscribed_Sphere (Corner_1, Corner_2, Corner_3, Height) // POINTS
A, B, C
union{
#declare Middle = Triangle_M_out (Corner_1, Corner_2, Corner_3); // POINT P /
Middle
#declare Radius = Triangle_R_out (Corner_1, Corner_2, Corner_3); //
#declare Normal = Triangle_Normal(Corner_1, Corner_2, Corner_3);
sphere {Middle, 0.1 translate Normal texture {Plane} }
object {Vector (Middle, vtransform ( Middle, transform {translate Normal} ),
0.05) texture {Plane}}
object {Vector (Middle, vtransform ( Middle, transform {translate -4*Normal}
), 0.05) texture {Plane}}
// translate Middle along Normal by Height to get point D
#declare PointD = vtransform ( Middle, transform {translate Normal*Height}
) ;
sphere {o, 0.1 translate PointD texture {Object} } // POINT D
sphere {Corner_A_3, 0.1 texture {Object} }
object {Vector (Corner_A_3, PointD, 0.05) texture {Tex_Dark}}
// midpoint EP
#declare Midpoint = (Corner_A_3 + PointD)/2;
sphere {Midpoint, 0.1 texture {Object} }
#declare Tangent = Triangle_Normal ( Corner_A_3, Middle, PointD );
// Perpendicular to triangle containing sphere center
#declare PerpRef = vtransform (Tangent*5, transform {translate Corner_A_3} );
// Just a big tangent
object {Vector (Corner_A_3, PerpRef, 0.05) texture {Plane}}
#declare Perp = vcross (PointD-Corner_A_3, Tangent);
#declare PerpN = vnormalize (Perp);
#declare PerpV = vtransform (Perp*2, transform {translate Midpoint} );
object {Vector (Midpoint, PerpV, 0.05) texture {Tex_Dark}}
#declare Adjacent = vlength (Midpoint - PointD);
#declare Theta = VAngleD (Midpoint - PointD, Middle - PointD);
#declare Opposite = Adjacent * atan (Theta);
#declare Center = vtransform (Midpoint, transform {translate PerpN *
Opposite} );
sphere {Center, 0.1 texture {Object} }
#declare SRadius = vlength (Center - PointD);
sphere {Center, SRadius texture {Shaded} } // Circumscribed sphere
}
#end
#declare Sphere = object {Circumscribed_Sphere (Corner_A_1, Corner_A_2,
Corner_A_3, H)};
Post a reply to this message
|
|