POV-Ray : Newsgroups : povray.advanced-users : Geometric task library? : Re: Geometric task library? Server Time
16 May 2024 13:54:03 EDT (-0400)
  Re: Geometric task library?  
From: FractRacer
Date: 6 Aug 2014 08:48:40
Message: <53e22428@news.povray.org>
Here a version sligthly modified, the circle (draw by a torus) is in 
contact with the 3 points of the triangle.

#declare Corner_A_1 = <0, 0, 0>;
#declare Corner_A_2 = <4, 0, 0>;
#declare Corner_A_3 = <4, 4, 0>;
#declare H = 1;

#local AT = text {
ttf "arial.ttf", "A", 0.02, 0.0 // thickness, offset
pigment{ color rgb<1,1,1>*0.5 }
}


#local BT = text {
ttf "arial.ttf", "B", 0.02, 0.0 // thickness, offset
pigment{ color rgb<1,1,1>*0.5 }
}

#local CT = text {
ttf "arial.ttf", "C", 0.02, 0.0 // thickness, offset
pigment{ color rgb<1,1,1>*0.5 }
}


#local DT = text {
ttf "arial.ttf", "d", 0.02, 0.0 // thickness, offset
pigment{ color rgb<1,0.5,0.5> }
scale 0.75
}

#local MT = text {
ttf "arial.ttf", "m", 0.02, 0.0 // thickness, offset
pigment{ color rgb<1,0.5,0.5> }
scale 0.75
}


#local Plane = texture {
pigment {color rgb 0.7}
}

#local Object = texture {
pigment {color rgb <0.7,0.3,0.1>}
}

#local Tex_Dark = texture {
pigment {color rgb <0.17,0.13,0.81>}
}

#local Shaded   = texture {
pigment {color rgb <0.2,0.2,0.2> filter 0.87}
}


#local Rayon = 0.125;

#macro Circumscribed_Sphere (Corner_1, Corner_2, Corner_3, Height)

union{
cylinder {Corner_A_1-0.15*z, Corner_A_1+0.1*z, Rayon  texture {Object} }
object {AT translate Corner_A_1-x*1-y*0.5}
cylinder {Corner_A_2-0.15*z, Corner_A_2+0.1*z, Rayon  texture {Object} }
object {BT translate Corner_A_2+x*0.5-y*0.5}
cylinder {Corner_A_3-0.15*z, Corner_A_3+0.1*z, Rayon  texture {Object} }
object {CT translate Corner_A_3+x*0.5+y*0.5}

// POINT P / Middle
#declare Middle =  Triangle_M_out (Corner_A_1, Corner_A_2, Corner_A_3);
#declare Radius =  Triangle_R_out (Corner_A_1, Corner_A_2, Corner_A_3); /
/
#declare Normal =  Triangle_Normal(Corner_A_1, Corner_A_2, Corner_A_3);
#local TMC = Triangle_Mass_Center(Corner_A_1, Corner_A_2, Corner_A_3);

cylinder {
	Middle-0.15*z, Middle+0.25*z, Rayon  translate Normal
	texture {Shaded}
}
object {MT translate Middle-x*0.5}
cylinder {
	TMC-0.15*z , TMC +0.1*z, Rayon
	translate Normal
	texture {Tex_Dark}
}

#declare PointD  =  vtransform (
	Middle, transform {translate Normal*Height}
);

//		object {DT translate PointD}
object {
	Distance_Marker(Corner_A_3, PointD, 0.025)
	pigment {color rgb <1,1,0>}
}

object {
	Distance_Marker(Corner_A_3, Corner_A_2, 0.025)
	pigment {color rgb <1,1,1>}
}

object {
	Distance_Marker(Corner_A_3, Corner_A_1, 0.025)
	pigment {color rgb <1,1,1>}
}

object {
	Distance_Marker(Corner_A_2, Corner_A_1, 0.025)
	pigment {color rgb <1,1,1>}
}

object {
	Distance_Marker(PointD, Corner_A_2, 0.025)
	pigment {color rgb <1,1,0>}
}

#declare Midpoint = (Corner_A_3 + PointD)/2;
cylinder {
	Midpoint-0.15*z, Midpoint+0.0*z, Rayon/2
	pigment {color rgb <2,0,0>}
}

#declare Tangent = Triangle_Normal ( Corner_A_3, Middle, PointD );

//#declare PerpRef = vtransform (Tangent*5, transform {translate 
Corner_A_3} );
//		object {
//			Distance_Marker(Corner_A_3, PerpRef, 0.025)
//			texture {Plane}
//		}


#declare Perp = vcross (PointD-Corner_A_3, Tangent);
#declare PerpN = vnormalize (Perp);
#declare PerpV = vtransform (Perp*2, transform {translate Midpoint} );

#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} );

#declare SRayon = vlength (Center - PointD);

torus {
	SRayon,0.01
	rotate x*90
	translate Middle
	pigment {color rgb <1,0.0,0.0>}
}
}
#end


#declare  Sphere = object {
	Circumscribed_Sphere (Corner_A_1, Corner_A_2,Corner_A_3, H)
};

Sphere

-- 
Do not judge my words, judge my actions.

---

parce que la protection avast! Antivirus est active.
http://www.avast.com


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.