POV-Ray : Newsgroups : povray.general : torus arrows Server Time
31 Oct 2024 14:12:11 EDT (-0400)
  torus arrows (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From: isuc60
Subject: torus arrows
Date: 8 Nov 2016 21:50:00
Message: <web.58228e15512a2627116828db0@news.povray.org>
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
}

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


Post a reply to this message

From: omniverse
Subject: Re: torus arrows
Date: 8 Nov 2016 23:25:00
Message: <web.5822a4c6329b68a89c5d6c810@news.povray.org>
"isuc60" <isu### [at] gmailcom> 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?)

Don't know if that script exists anywhere but you probably need a simple
explanation using a correct scene. Read and render this:

union
{
 // axis
 cylinder {-3*y,3*y,0.1 pigment{blue 1}}

 // put pointer at cut curve end <0,0,2>
  cone {x+(2*z),0.0, z*2,0.3 } //add pointed end with length x
  // and match base (0.3 wide) position with curve end

  difference {
    torus { 2,0.1 } // curves on y plane
     // cut with box from center outward past edge
     // with cuts of curve at <0,0,2> and <2,0,0>
    box { <0,-0.11,0>,<2.11,0.11,2.11> }
  }

  pigment { green 1 }
  //finish {emission 1} // make visible glow without light
 no_shadow
 // no rotation shows left-handed y rotation
 // rotate <90,0,0> // shows left-handed z rotation
 // rotate <-90,-90,0> // shows left-handed x rotation
 // move away from origin to see with default camera
 translate <0,0,5>
}

light_source{<10,10,-10>,1}
camera{location <4,4,-2> look_at <0,0,5>}


Post a reply to this message

From: Bald Eagle
Subject: Re: torus arrows
Date: 9 Nov 2016 08:00:01
Message: <web.58231cd4329b68a8b488d9aa0@news.povray.org>
If you're new to povray,

1.  Welcome!   :)

and

2. if you want to do stuff like that,


http://www.f-lohmueller.de/pov_tut/pov__eng.htm

http://www.f-lohmueller.de/pov_tut/a_geo/a_geo__e.htm

and checking out the INSERT menu included with POV-Ray, which has a lot of
pre-written scene fragments.

The subdirectories of your POV-Ray installation will likely have a lot of sample
scenes and .pov, .ini, and .inc files.


Post a reply to this message

From: Alain
Subject: Re: torus arrows
Date: 9 Nov 2016 19:28:51
Message: <5823bf43$1@news.povray.org>

> 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

From: isuc60
Subject: Re: torus arrows
Date: 10 Nov 2016 20:10:01
Message: <web.58251a3e329b68a8116828db0@news.povray.org>
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

From: Stephen
Subject: Re: torus arrows
Date: 11 Nov 2016 06:10:10
Message: <5825a712$1@news.povray.org>
On 11/11/2016 1:09 AM, isuc60 wrote:
> 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.


Hi
I do not understand what you think is wrong.
Do you mean the the vertical arrows are not in the centre of the torus 
arrows?

If that is the case, you might get a better idea of your scene if you do 
a render from the top, front and side. To adjust the translations and 
see what is happening.

Another thing that might be confusing is PovRay's coordinate system. 
Normally the Y axis is up. Some other programs use the Z axis for up.

-- 

Regards
     Stephen


Post a reply to this message

From: Bald Eagle
Subject: Re: torus arrows
Date: 11 Nov 2016 07:50:00
Message: <web.5825bdf5329b68a8b488d9aa0@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
>... you might get a better idea of your scene if you do
> a render from the top, front and side. To adjust the translations and
> see what is happening.
>
> Another thing that might be confusing is PovRay's coordinate system.
> Normally the Y axis is up. Some other programs use the Z axis for up.

Yes.
Take all of your objects and put them inside one big union{}

#declare Scene = union {
(all of your scene objects)
}

Then you can:
object {Scene translate x*10 rotate  y*90}
object {Scene translate y*10 rotate -x*90}

to get 3 orthogonal views.

Stephen's suggestion about mapping out the axes so that you can keep track is a
great one - it helps keep everything straight when you're trying to write SDL
and get all the parameters right.

Also, when using a difference, I find it helpful to define the object being
subtracted as a separate object, then use it in the difference{}, but also PLACE
IT into the scene with something like pigment {rgbt <1, 0, 0, 0.95>} so that it
shows up as a transparent thing that you can see.   Because sometimes you make a
mistake and the thing you want to subtract isn't in the right place or
orientations at all, and this helps debug the scene.

Great work so far - keep it up   :)


Post a reply to this message

From: Stephen
Subject: Re: torus arrows
Date: 11 Nov 2016 12:37:45
Message: <582601e9$1@news.povray.org>
On 11/11/2016 12:47 PM, Bald Eagle wrote:
> Stephen's suggestion about mapping out the axes so that you can keep track is a
> great one - it helps keep everything straight when you're trying to write SDL
> and get all the parameters right.

I define Front, side, Top orthogonal cameras and a free moving camera 
for taking the image. Duplicating the set up of a technical drawing.
Bald Eagle's idea of using transparent textures for unions is very useful.

-- 

Regards
     Stephen


Post a reply to this message

From: isuc60
Subject: Re: torus arrows
Date: 14 Nov 2016 19:50:06
Message: <web.582a5a7a329b68a8116828db0@news.povray.org>
Thank all of you so much for your great help!

This is an awesome platform. My skill grows everyday. Now, I am able to use most
of techniques that you introduced.

Here comes with a new challenge. I want to read data from a file on my disk. The
data file has something like this

1.0, 2.0,3.0, 4.0, 5.0, 6.0
7.0, 8.0, 9.0, 10.0,11.0,12.0

I want to draw an arrow from
Vector (1,2,3) to Vector (4,5,6)
and so on.

I read most of the 2.8.4.3 File Input/Output, and one post on the forum.
This is my first script.

//---------------------Head------------------------

#declare Vector1 = array[2][3] //2 rows and 3 columns
#declare Vector2 = array[2][3]

#fopen MyFile "data" read
#fopen MyFile1 "data.out" write
#while (defined(MyFile))
#read (MyFile,VECTOR_IDENTIFIER,Vector1,Vector2)
#write (MyFile1,VECTOR_IDENTIFIER,Vector1,Vector2)// check what I am reading in
any data
#end
//---------------------end--------------------------------

Hey, this does not work. It only reads one line, and even the output has a wrong
number.

I would appreciate it if you could point out my mistakes.

Thanks a lot again!

Best wishes,

Guoping



"Bald Eagle" <cre### [at] netscapenet> wrote:
> Stephen <mca### [at] aolcom> wrote:
> >... you might get a better idea of your scene if you do
> > a render from the top, front and side. To adjust the translations and
> > see what is happening.
> >
> > Another thing that might be confusing is PovRay's coordinate system.
> > Normally the Y axis is up. Some other programs use the Z axis for up.
>
> Yes.
> Take all of your objects and put them inside one big union{}
>
> #declare Scene = union {
> (all of your scene objects)
> }
>
> Then you can:
> object {Scene translate x*10 rotate  y*90}
> object {Scene translate y*10 rotate -x*90}
>
> to get 3 orthogonal views.
>
> Stephen's suggestion about mapping out the axes so that you can keep track is a
> great one - it helps keep everything straight when you're trying to write SDL
> and get all the parameters right.
>
> Also, when using a difference, I find it helpful to define the object being
> subtracted as a separate object, then use it in the difference{}, but also PLACE
> IT into the scene with something like pigment {rgbt <1, 0, 0, 0.95>} so that it
> shows up as a transparent thing that you can see.   Because sometimes you make a
> mistake and the thing you want to subtract isn't in the right place or
> orientations at all, and this helps debug the scene.
>
> Great work so far - keep it up   :)


Post a reply to this message

From: Bald Eagle
Subject: Re: torus arrows
Date: 15 Nov 2016 08:25:01
Message: <web.582b0bf9329b68a8b488d9aa0@news.povray.org>
I'm at work now, but give this a look and see if this example scene helps


http://news.povray.org/povray.binaries.scene-files/thread/%3Cweb.56d702f78f8162b55e7df57c0%40news.povray.org%3E/


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

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