|
|
Dear Ominverse, Bald Eagle and Alain,
Thank you so much!
This is extremely helpful to me. I have read your comments carefully.
I found an example "a_geo_lin02.pov" from http://wwww.f-lohmueller.de. I also
followed Ominverse's and Alain suggestions to rotate.
Alain, Thanks a lot for your explanation about this -2*z,0.0, -2*z+1*x,0.3. In
physics, x,y,z are called unit vectors.
Here is my first pov file. If you render it, you will find that the arrows that
I have for the moment are not entirely straightforward, because of "difference"
commend cutoff. I really struggle a lot on this since I could not find an easy
to know what the box should be.
I wonder whether you have some idea or can modify my following script, so my
script does not have this problem.
Thank you very much!
Best regards,
Guoping
// PoVRay 3.7 Scene File "a_geo_lin02.pov"
// Author: Friedrich A. Lohmueller, 2004/2009/2011
// email: Fri### [at] t-onlinede
// homepage: http://wwww.f-lohmueller.de
//
//------------------------------------------------------------------------
global_settings{ assumed_gamma 1.0 }
//------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"
#include "transforms.inc"
//------------------------------------------------------------------------
#declare Camera_0 = camera { // xy-view
angle 20
location <0.0 , 0.0 ,-38.0>
right x*image_width/image_height
look_at <0.0, 0.0 , 0.0>
}
#declare Camera_1 = camera { // diagonal view
angle 9
location <40.0 ,40.5 ,-40.0>
right x*image_width/image_height
look_at <0.3 , 1.5 ,-0.2>
}
#declare Camera_2 = camera { // yz-view
angle 20
location <31.0 , 7.0 ,1.0>
right x*image_width/image_height
look_at <1.5 , 1.4 , 1.0>
}
#declare Camera_3 = camera {
angle 20
location < 0.0 , 37.5 ,-0.0001>
right x*image_width/image_height
look_at <0 , 0 , 2.0>
}
#declare Camera_4 = camera {
angle 20
location < 0.0 , 37.5 ,-0.000>
right x*image_width/image_height
look_at <0 , 0 , 00>
}
#declare Camera_5 = camera {
angle 5
location <40.0 ,40.5 ,-40.0>
right x*image_width/image_height
look_at <0.3 , 1.5 ,-0.2>
}
camera{Camera_1}
//------------------------------------------------------------------------
// sun -------------------------------------------------------------------
light_source{<1500,2500,-2500> color White}
// sky -------------------------------------------------------------------
sky_sphere{ pigment{ gradient <0,1,0>
color_map{ [0 color rgb<1,1,1> ]//White
[0.4 color rgb<1,1,1>]//~Navy
[0.6 color rgb<1,1,1>]//<0.14,0.14,0.56>]//~Navy
[1.0 color rgb<1,1,1> ]//White
}
scale 2 }
} // end of sky_sphere
//------------------------------------------------------------------------
// This is my arrow first.
#declare xdir=-1.5;
#declare ydir=-3.5;
#declare zdir=-1.5;
union{
union{
cone {
<xdir, ydir-1, zdir>, 0.0 // first three number are x,y,z coordinates,
and the last number is radius. Center and radius of one end
<xdir, ydir, zdir>, 0.3 // Center and radius of other end
texture {
pigment{color rgb<1,0.55,0.0>}
finish {ambient 0.15 diffuse 0.85 phong 1}
}
no_shadow
}
cylinder {
<xdir,ydir,zdir>, // Center of one end
<xdir,ydir+3.5, zdir>, // Center of other end
0.1 // Radius
open // Remove end caps
texture {
pigment{color rgb<1,0.55,0>}
finish {ambient 0.15 diffuse 0.85 phong 1}
}
no_shadow
}
rotate <0,0,0> // shows left-handed x rotation
//translate <-3,-1,0>
}
//plane { <0, 1, 0>, -10
// pigment {
// checker color Blue, color White
//checker color rgb < 0.05, 0, 0.35>, color White
// }
// }
union
{
cone { 1.5*z,0.3, 1.5*z+1*x,0 }
difference {
torus { 1.5,0.1 }
box { <0,-0.5,-1>,<2,0.5,2> }
}
// pigment { Green }
texture {pigment{ color rgb<0.2,0,0.3>}
finish { phong 0.8}}
no_shadow
// apply texture as needed
rotate <180,0,0> // shows left-handed x rotation
translate <-3,-3,0>
}
//===========================second arrow===============
///////////////////////////
union{
cone {
<xdir, ydir-1, zdir>, 0.0 // first three number are x,y,z coordinates,
and the last number is radius. Center and radius of one end
<xdir, ydir, zdir>, 0.3 // Center and radius of other end
texture {
pigment{color rgb<1,0.55,0.0>}
finish {ambient 0.15 diffuse 0.85 phong 1}
}
no_shadow
}
cylinder {
<xdir,ydir,zdir>, // Center of one end
<xdir,ydir+3.5, zdir>, // Center of other end
0.1 // Radius
open // Remove end caps
texture {
pigment{color rgb<1,0.55,0>}
finish {ambient 0.15 diffuse 0.85 phong 1}
}
no_shadow
}
rotate <180,0,0> // shows left-handed x rotation
translate <2,-5,0>
}
//////////////////////////////
union
{
cone { 1.5*z,0.3, 1.5*z+1*x,0 }
difference {
torus { 1.5,0.1 }
box { <0,-1,0>,<4,1,4> }
}
// pigment { Red }
texture {pigment{ color rgb<1,0,0>}
finish { phong 0.8}}
no_shadow
// apply texture as needed
rotate <0,120,0> // shows left-handed x rotation
translate <2,0.,0>
}
translate <0,3.5,0>
}
union{
box { <-3,-0.8,-2>,<3,-1.0,2> }
pigment {
// checker color Blue, color White
checker color rgb < 0.45, 0, 0.15>, color White
}
no_shadow
}
//==================++++END===========================
Alain <kua### [at] videotronca> wrote:
> > Dear povray community,
> >
> > I am totally new to Povray, but am very interested to learn how to draw
> > torus arrows, like the second figure on
> > http://www.povray.org/documentation/view/3.6.1/15/
> > (Does anyone have the script for this figure?)
> >
> > I found a script like this
> >
> > union
> > {
> > // cone {-2*z,0.0, -2*z+1*x,0.3 }
> >
> > cone {-2*y-2*x,0.0, -2,0.3 }
> > difference {
> > torus { 2,0.1 }
> > box { <1,-1,0>,<-2,1,6> }
> > }
> > pigment { Green }
> > no_shadow
> > translate <4,4,0>
> > // apply texture as needed
> > }
> First, the object defined above:
> It's a torus with a chunk removed by the box.
> To it, is added a cone.
>
> The center of the torus start at the origin and is later moved to the
> location <4,4,0> or 4 unit to the right or +X and 4 units up or +Y.
> There is no displacement along the Z axis, the zero value.
> The "no_shadow" purpose is to suppress the casting of a shadow by the
> object. It may not be usefull to you and can be removed.
>
> >
> > But the arrow does not go to the location that I want. Also I do not understand
> > cone{-2*z,0.0, -2*z+1*x,0.3}.
> >
> > Any help is greatly appreciated!
> >
> > Best regards,
> >
> > Guoping Zhang
> >
> >
> >
> >
> >
> >
>
> For "cone(-2*z,0.0, -2*z+1*x,0.3)", you are seeing an alternate notation
> that take advantage of some shortcuts.
> It evaluate as :
> cone{ <0, 0, -2>, 0, <1, 0, -2>, 0.3}
> That's a cone pointing right with a base radius of 0.3 unit and tapering
> to a tip of 0 unit radius. It's length is 1 unit parallel to the X axis.
> Note : a cone can take a negative radius. In this case, you'll get a
> double cone. You can try this :
> cone{2*x, 2, -2*x, -2 pigment{rgb 1} inside_texture{pigment{rgb<0,0,1>}}}
> Yes, the left part IS blue.
>
> The complete object is a 3/4 of a torus with a major radius of 2 units
> and a minor radius of 0.1 unit and a cone making a circular arrow
> indicating a clockwise rotation. It start at the origin, but gets mooved
> away from it by the translate<4,4,0>.
>
> Start by removing the translate. This put the object back around the
> origin. Give it a name like :
> #declare Circular_Arrow = union{...}
>
> If you need to, use "rotate <XRot, YRot, ZRot> to orient it like you
> want. You may want to first rotate it around the Y axis, then tilt it.
> It can be done as follow :
> rotate Angle*y rotate <XTilt, 0, ZTilt>
>
> Finally, move it to where you want it to be using your own translate
> statement.
> translate My_Location or translate <XPosition, YPosition, ZPosition>
>
>
> Alain
Post a reply to this message
|
|