|
|
OK, Here's the rough draft.
I use a normal line for my trace function - a haven't implemented the plane yet
- I need to figure out a check for coincidence with the trace line.
It also doesn't calculate / plot the correct normal for triangle A-B-D, which is
weird (and p------ me off) because it uses the same F. Lohmueller macro as all
the other faces of the tetrahedron. What. The. Heck.
--------------------------------------------------
#declare Corner_A_1 = <0, 4, -2>;
#declare Corner_A_2 = <4, 4, -2>;
#declare Corner_A_3 = <2, 8, -2>;
#declare H = 0.5;
//
##############################################################################################################
// Circumscribe a sphere around a triangle and a 4th "tetrahedral point"
determined by Height
#macro Circumscribed_Sphere (Corner_1, Corner_2, Corner_3, Height)
#local MacroName = "Circumscribed_Sphere"
#if (verbose = true)
#debug concat("macro '", MacroName, "' called with arguments: ")
#debug concat("<", vstr(3, Corner_1, ", ", 0, 1), ">, <", vstr(3, Corner_2,
", ", 0, 1), ">, <", vstr(3, Corner_3, ", ", 0, 1), ">, ", str(Height, 3, 3), "
\n")
#end // end verbose debugging output
// ################
#local Markers = true; // Display points and geometric construction lines
#local SolidBlue = texture {pigment {color rgb <0, 0, 1> } finish {ambient
0.6}};
#local SolidRed = texture {pigment {color rgb <1, 0, 0> } finish {ambient
0.6}};
#local SolidYellow = texture {pigment {color rgb <1, 1, 0> } finish {ambient
0.6}};
#local SolidGreen = texture {pigment {color rgb <0, 1, 0> } finish {ambient
0.6}};
#local SolidGray = texture {pigment {color rgb <0.5, 0.5, 0.5> } finish
{ambient 0.6}};
#local Point_radius = 0.125;
#local Line_radius = 0.125/4;
union{
// POINT P / Middle
#local Middle = Triangle_M_out (Corner_1, Corner_2, Corner_3);
#local Radius = Triangle_R_out (Corner_1, Corner_2, Corner_3);
#local Normal = Triangle_Normal(Corner_1, Corner_2, Corner_3);
#declare CC_Radius = vlength (Middle - Corner_1);
#local PointD = vtransform (Middle, transform {translate Normal*Height});
// Tetrahedral faces
#local Middle12D = Triangle_M_out (Corner_1, Corner_2, PointD);
#local Radius12D = Triangle_R_out (Corner_1, Corner_2, PointD);
#local Normal12D = Triangle_Normal(Corner_1, Corner_2, PointD);
#local Middle23D = Triangle_M_out (PointD, Corner_2, Corner_3);
#local Radius23D = Triangle_R_out (PointD, Corner_2, Corner_3);
#local Normal23D = Triangle_Normal(PointD, Corner_2, Corner_3);
#local Normal23DVector = vtransform (Middle23D, transform {translate
-Normal23D*10});
#local Middle31D = Triangle_M_out (Corner_1, PointD, Corner_3);
#local Radius31D = Triangle_R_out (Corner_1, PointD, Corner_3);
#local Normal31D = Triangle_Normal(Corner_1, PointD, Corner_3);
#local Centerline = vtransform (Middle, transform {translate -Normal*10});
#local Centertrace = object {cylinder {PointD, Centerline, 0.01} }
#declare CS_Center = trace (Centertrace, Middle23D, -Normal23D );
#declare CS_Radius = vlength (PointD - CS_Center);
#if (Markers = true)
sphere {Corner_A_1, Point_radius texture {SolidBlue} }
object {LabelPoint (Corner_1, "A", 0.5) texture {SolidRed} }
sphere {Corner_A_2, Point_radius texture {SolidBlue} }
object {LabelPoint (Corner_2, "B", 0.5) texture {SolidRed} }
sphere {Corner_A_3, Point_radius texture {SolidBlue} }
object {LabelPoint (Corner_3, "C", 0.5) texture {SolidRed} }
// circumcenter of triangle ABC
sphere {Middle, Point_radius texture {SolidBlue} }
object {LabelPoint (Middle, "m", 0.5) texture {SolidBlue} }
// Circumcircle of original triangle
torus { CC_Radius, Line_radius rotate x*90 translate Middle texture
{SolidBlue} no_shadow}
// new tetrahedral point
sphere {PointD, Point_radius texture {SolidGray} }
object {LabelPoint (PointD, "D", 0.5) texture {SolidGray} translate
Normal*Height}
object {Centertrace texture {SolidGreen} } // extended normal of original
triangle
object {PointMarker (Middle12D, Line_radius) texture {SolidGray} }
torus {Radius12D, Line_radius Reorient_Trans(y, Normal12D) translate
Middle12D texture {SolidGray} }
object {Distance_Marker(Middle12D, vtransform (Middle12D, transform
{translate -Normal12D*CS_Radius}), Line_radius) texture {SolidGreen}}
object {PointMarker (Middle23D, Line_radius) texture {SolidGray} }
torus {Radius23D, Line_radius Reorient_Trans(y, Normal23D) translate
Middle23D texture {SolidGray} }
object {Distance_Marker(Middle23D, Normal23DVector, 0.025) texture
{SolidGreen}}
object {PointMarker (Middle31D, Line_radius) texture {SolidGray} }
torus {Radius31D, Line_radius Reorient_Trans(y, Normal31D) translate
Middle31D texture {SolidGray} }
object {Distance_Marker(Middle31D, vtransform (Middle31D, transform
{translate -Normal31D*CS_Radius}), Line_radius) texture {SolidGreen}}
object {Distance_Marker(Corner_1, Corner_2, Line_radius) texture
{SolidBlue}}
object {Distance_Marker(Corner_2, Corner_3, Line_radius) texture
{SolidBlue}}
object {Distance_Marker(Corner_3, Corner_1, Line_radius) texture
{SolidBlue}}
object {Distance_Marker(Corner_1, PointD, Line_radius) texture
{SolidGray}}
object {Distance_Marker(Corner_2, PointD, Line_radius) texture
{SolidGray}}
object {Distance_Marker(Corner_3, PointD, Line_radius) texture
{SolidGray}}
object {PointMarker (CS_Center, Line_radius) texture {SolidRed} } //
Circumcenter of sphere
object {LabelPoint (CS_Center, "Circumcenter", 0.5) texture {SolidGreen} }
#end // end diagram markers
sphere {CS_Center, CS_Radius} // THE ACTUAL SPHERE
} // end union
// ################
#if (verbose = true)
#debug concat ("Sphere Circumcenter = <", vstr(3, CS_Center, ", ", 0, 1), ">
\n")
#debug concat ("Sphere Circumradius = ", str (CS_Radius, 3, 1), "\n")
#debug concat ("macro '", MacroName, "' finished. \n")
#end // end verbose debugging output
#end // end of macro
//
##############################################################################################################
Macro for PointMarkers:
//
##############################################################################################################
// Plot an x-y-z point marker.
#macro PointMarker (Point, Radius)
#local MacroName = "PointMarker"
#if (verbose = true)
#debug concat("macro '", MacroName, "' called with arguments: ")
#debug concat("<", vstr(3, Point, ", ", 0, 1), ">, ", str(Radius, 3, 3), "
\n")
#end // end verbose debugging output
// ################
#local MarkerHeight = 0.25;
union {
cylinder { <Point.x-MarkerHeight, Point.y, Point.z>, <Point.x+MarkerHeight,
Point.y, Point.z>, Radius}
cylinder { <Point.x, Point.y-MarkerHeight, Point.z>, <Point.x,
Point.y+MarkerHeight, Point.z>, Radius}
cylinder { <Point.x, Point.y, Point.z-MarkerHeight>, <Point.x, Point.y,
Point.z+MarkerHeight>, Radius}
}
// ################
#if (verbose = true)
#debug concat("macro '", MacroName, "' finished. \n")
#end // end verbose debugging output
#end // end of macro
//
##############################################################################################################
Post a reply to this message
|
|