|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Does anyone know of a source for existing code or macros for performing
geometric tasks that are likely to crop up while modeling things in 3d?
Circumscribing a circle around a triangle, finding the center of a sphere that
includes that circle in its surface, finding a circle that is tangent to 3 other
circles, etc.
No doubt, I could code a few such algebraic solutions to geometric problems, but
why reinvent the wheel, and there might be methods out there that use POV-Ray's
bounding boxes and other features to speed up the process...
Thanks!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
> Does anyone know of a source for existing code or macros for performing
> geometric tasks that are likely to crop up while modeling things in 3d?
>
> Circumscribing a circle around a triangle, finding the center of a sphere that
> includes that circle in its surface, finding a circle that is tangent to 3 other
> circles, etc.
>
> No doubt, I could code a few such algebraic solutions to geometric problems, but
> why reinvent the wheel, and there might be methods out there that use POV-Ray's
> bounding boxes and other features to speed up the process...
>
> Thanks!
>
>
Take a look at the page of Friedrich A. Lohmueller, he wrote an
analytical_g.inc file (macros for Analytical Geometry)
http://wwww.f-lohmueller.de
--
Do not judge my words, judge my actions.
---
http://www.avast.com
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I took a look at that.
Thanks a lot for looking through that for me.
See:
http://news.povray.org/povray.binaries.images/thread/<web.53e25769ad990c965e7df57c0%40news.povray.org>/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|