POV-Ray : Newsgroups : povray.newusers : Stupid newbie Q #453653... Server Time
14 Nov 2024 14:18:23 EST (-0500)
  Stupid newbie Q #453653... (Message 1 to 4 of 4)  
From: J B Cattley
Subject: Stupid newbie Q #453653...
Date: 18 Aug 1998 15:51:09
Message: <35d9cd1d.0@news.povray.org>
Ok, I've had POV for three days, and I have one burning question so far:

Do I have to give everything absolute coordinates?

As far as I can see, If I want to create a standard object for multiple use,
like, say, a 1 by 3 unit box, I have to specify exactly where I want it. I
don't seem to be able to just specify the dimensions, and then plonk it down
at a given location.

I suppose I could put everything at <0,0,0> and then translate as necessary,
but this seems kludgy, somehow. I seem to be missing the point, but the help
isn't very clear on this.

Someone show Idjit Boy the light, would they?

Thanks!

jbc

(email CCs would be appreciated.)


Post a reply to this message

From: K  Tyler
Subject: Re: Stupid newbie Q #453653...
Date: 18 Aug 1998 16:14:39
Message: <35D9C43D.46650ACE@pacbell.net>
J.B Cattley wrote:

> Ok, I've had POV for three days, and I have one burning question so far:
>
> Do I have to give everything absolute coordinates?
>
> As far as I can see, If I want to create a standard object for multiple use,
> like, say, a 1 by 3 unit box, I have to specify exactly where I want it. I
> don't seem to be able to just specify the dimensions, and then plonk it down
> at a given location.
>
> I suppose I could put everything at <0,0,0> and then translate as necessary,
> but this seems kludgy, somehow. I seem to be missing the point, but the help
> isn't very clear on this.
>
> Someone show Idjit Boy the light, would they?
>
> Thanks!
>
> jbc
>
> (email CCs would be appreciated.)

Response to Stupid newbie Q #453653...

  Not all standard pov primatives have to be built at the origin.
Take for example the sphere.

sphere{<-1,1,0>,1}

This will make a sphere located at 1 unit left, 1 unit up and has a size
of 1 unit.

Let's look at another example

cylinder{<-2,10,0>,<2,10,0>,1}

This will make a cylinder stretching left to right 4 units placed 10
units up in the y direction and has a diameter of 1 pov unit.

Let's try a different example for the cylinder.

cylinder{<-2,-1,0>,<2,1,0>,1}

now you have a cylinder that starts on the lower left and goes up to
the right.

You could accomplish the same thing by specifying the cylinder as
I did the first one and then applying a rotate command to it.

I'll give you one more example.

cylinder{<-20,0,0>,<0,0,0>,1}

This will give you a cylinder that starts at 20 units to the left and
stops at center screen. So you see without applying any transformation
the object is not neccessarily constrained to the origin.

Each primitive shape in POV-Ray has it's own unique syntax and it
takes a while to learn. I suggest you take a look at the example files that
came with the POV-Ray package you downloaded. you will find many
different ways of accomplishing the same thing just using different methods..

Need further assistance or what I've said is a complete mystery too you ?
Feel free to ask for more assistance.

K.Tyler


Post a reply to this message

From: Ron Parker
Subject: Re: Stupid newbie Q #453653...
Date: 18 Aug 1998 17:07:19
Message: <35d9def7.0@news.povray.org>
On Wed, 19 Aug 1998 04:51:41 +1000, J.B Cattley <jbc### [at] mpxcomau> wrote:
>Do I have to give everything absolute coordinates?

>As far as I can see, If I want to create a standard object for multiple use,
>like, say, a 1 by 3 unit box, I have to specify exactly where I want it. I
>don't seem to be able to just specify the dimensions, and then plonk it down
>at a given location.

This is true.  If it were not, how would you specify which point on
the box was supposed to be at the given location?

>I suppose I could put everything at <0,0,0> and then translate as necessary,
>but this seems kludgy, somehow. I seem to be missing the point, but the help
>isn't very clear on this.

By doing this, you're telling POV-Ray that the part of the box that falls at
<0,0,0> should be at the given location, thus solving the problem above.

If you wanted to go to the extra work, you could create macros in POV 3.1
that would allow you to do what I think you want to do.  For example, if you
want to create a box of given dimensions centered on the origin and ready to
be translated, you could do:

#macro my_box( size )
    box { -.5*size, .5*size }
#end

And then you could do something like:

object { my_box(<3,5,7>) translate <15,20,30> texture {...}}

to create a box of size 3x5x7, centered on the point <15,20,30>.


Post a reply to this message

From: Johannes Hubert
Subject: Re: Stupid newbie Q #453653...
Date: 19 Aug 1998 03:11:54
Message: <35da6caa.0@news.povray.org>
J.B Cattley wrote in message <35d9cd1d.0@news.povray.org>...

>
>I suppose I could put everything at <0,0,0> and then translate as
necessary,
>but this seems kludgy, somehow. I seem to be missing the point, but the
help
>isn't very clear on this.


Actually, it is recommendable to get into the habit of creating everything
around the origin at <0, 0, 0> (even the docs do recommand that
somewhere...)

The reason is, that rotation always works around the main axis:
If you have a cube that you want to rotate around its own center, and the
cube is not centered around the origin, then you have to go like this:
Translate the cube until the axis of rotation falls into one of the
main-axis, rotate it, translate it back into position.

Now, you can make your life easier if you create the cube already in a way,
that its intended "center" falls into the origin. You can then rotate it and
then translate it into position.

So the standard way of creating an object is:

1. Create it in a way, that the object's "center" lies in <0, 0, 0> (some
objects, like the torus, can't be created in any other way, others, like the
"box", can).
2. Scale it, so that it is sized and deformed like you want it.
3. Rotate it, so that it is aligned like you want it.
4. Translate it into its final position.

Of course, you won't need all steps for all objects all the time, but the
*order* of the steps should be the same.

(BTW: This is how Moray creates its objects...)

Note: For objects that are always created at the origin (like a torus) this
may have to be modified, if the "center" you want to use does not fall into
the "default-center" of the object:

1. Create the object (at the origin by default)
2. Translate it so that the "center" you want to use falls into the origin
3. Scale it correctly
4. Rotate it into the right alignment
5. Translate it into the right position

It may seem a bit of a bother at the beginning, but once you get into the
habit of using this procedure, it only has advantages.

Hope it helps a bit,
Johannes.


Post a reply to this message

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