POV-Ray : Newsgroups : povray.advanced-users : Enabling relative coordinate placement Server Time
23 Dec 2024 18:50:09 EST (-0500)
  Enabling relative coordinate placement (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: Kene
Subject: Enabling relative coordinate placement
Date: 20 Sep 2009 12:40:00
Message: <web.4ab65a2cf8370660772dd76f0@news.povray.org>
Hi:

I am building a set of macros and hopefully functions that can assist an
architect in making a building using POVRay. I understand that I cannot export
2D technical sections of the resulting design but my hopes are that if I can cut
3D sections of the building, then I can wait until POVRay can support the
process more.

My hitch right now is that I cannot enable relative coordinate placement.

It is important to be able to create an object relative to the position of
another in architecture. For example a wall can be created with coordinates
<0,0,0> <150,8000,3000> (thickness = 0.15 m, length = 8 m, height = 3 m) then
rotated to 35 degrees and translated to <5000,1000,0>. It must be possible to
create a second wall at a relative position and angle to this one without having
to do the necessary calculation from the origin. For a professional activity the
work of redoing calculations each time a design is updated or reconfigured is
very frustrating, error-prone and time-consuming.

A macro can be created to automatically create the wall with the required
thickness, length, height, rotation and final position.

for example:
#declare BedRm_North_Wall = Make_Wall( Length, Height, Thickness, Rotate_Angle,
Translate_Distance )

These are my questions:

1. Ability to create new object by referencing the location of another. The
placement of the new object is a distance or angle relative to the existing
object. For example to create a new wall by referencing the position of
BedRm_North_Wall
   - #declare BedRm_South_Wall = Make_Wall_Offset( BedRm_North_Wall, New_Length,
New_Height, New_Thickness, Offset_Distance )

2. Functions in a macro or that can get information from a macro
   I would like to be able to perform actions on a declared object. For example
instead of rotating and/or translating when they are created, these actions can
be performed afterward for example
   - #declare BedRm_North_Wall = Make_Wall( Length, Height, Thickness )
   - BedRm_North_Wall_Rotate( angle )
   - BedRm_North_Wall_Offset( offset_distance )

An option would be to write a new (text-based) tool to interface with POVRay
which may be necessary. But if I can do the above I will rather get work done
with the wonderful existing POVRay SDL.


Post a reply to this message

From: clipka
Subject: Re: Enabling relative coordinate placement
Date: 20 Sep 2009 12:56:14
Message: <4ab65eae$1@news.povray.org>
Kene schrieb:
> 1. Ability to create new object by referencing the location of another. The
> placement of the new object is a distance or angle relative to the existing
> object. For example to create a new wall by referencing the position of
> BedRm_North_Wall
>    - #declare BedRm_South_Wall = Make_Wall_Offset( BedRm_North_Wall, New_Length,
> New_Height, New_Thickness, Offset_Distance )

Definitely not possible in POV-Ray, unless you write your own framework 
(i.e. basically place another language on top of SDL) to do this sort of 
things.

> 2. Functions in a macro or that can get information from a macro
>    I would like to be able to perform actions on a declared object. For example
> instead of rotating and/or translating when they are created, these actions can
> be performed afterward for example
>    - #declare BedRm_North_Wall = Make_Wall( Length, Height, Thickness )
>    - BedRm_North_Wall_Rotate( angle )
>    - BedRm_North_Wall_Offset( offset_distance )

you can define macros as:

   #macro Rotate_Object(Obj,Angle)
     object { Obj rotate Angle }
   #end

which you could then use like this:

   #declare BedRm_North_Wall = Make_Wall( Length, Height, Thickness )
   Rotate_Object ( BedRm_North_Wall, angle )
   ...


Post a reply to this message

From: Kene
Subject: Re: Enabling relative coordinate placement
Date: 20 Sep 2009 13:30:00
Message: <web.4ab6655fba1022f6772dd76f0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Kene schrieb:
> > 1. Ability to create new object by referencing the location of another. The
> > placement of the new object is a distance or angle relative to the existing
> > object. For example to create a new wall by referencing the position of
> > BedRm_North_Wall
> >    - #declare BedRm_South_Wall = Make_Wall_Offset( BedRm_North_Wall, New_Length,
> > New_Height, New_Thickness, Offset_Distance )
>
> Definitely not possible in POV-Ray, unless you write your own framework
> (i.e. basically place another language on top of SDL) to do this sort of
> things.
>
> > 2. Functions in a macro or that can get information from a macro
> >    I would like to be able to perform actions on a declared object. For example
> > instead of rotating and/or translating when they are created, these actions can
> > be performed afterward for example
> >    - #declare BedRm_North_Wall = Make_Wall( Length, Height, Thickness )
> >    - BedRm_North_Wall_Rotate( angle )
> >    - BedRm_North_Wall_Offset( offset_distance )
>
> you can define macros as:
>
>    #macro Rotate_Object(Obj,Angle)
>      object { Obj rotate Angle }
>    #end
>
> which you could then use like this:
>
>    #declare BedRm_North_Wall = Make_Wall( Length, Height, Thickness )
>    Rotate_Object ( BedRm_North_Wall, angle )
>    ...

Supposing the object has been translated to <1500,8000,0> my guess is that the
rotation you describe above will no longer work as expected. The wall has to be
rotated when created at <0,0,0> before being moved. Right?


Post a reply to this message

From: Warp
Subject: Re: Enabling relative coordinate placement
Date: 20 Sep 2009 13:32:24
Message: <4ab66728@news.povray.org>
Kene <nomail@nomail> wrote:
> Supposing the object has been translated to <1500,8000,0> my guess is that the
> rotation you describe above will no longer work as expected. The wall has to be
> rotated when created at <0,0,0> before being moved. Right?

  If the object is already at <1500,8000,0>, then what you can do is simply:

translate -<1500,8000,0>
rotate whatever
translate <1500,8000,0>

-- 
                                                          - Warp


Post a reply to this message

From: Kene
Subject: Re: Enabling relative coordinate placement
Date: 20 Sep 2009 13:40:01
Message: <web.4ab66809ba1022f6772dd76f0@news.povray.org>
"Kene" <nomail@nomail> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Kene schrieb:
> > > 1. Ability to create new object by referencing the location of another. The
> > > placement of the new object is a distance or angle relative to the existing
> > > object. For example to create a new wall by referencing the position of
> > > BedRm_North_Wall
> > >    - #declare BedRm_South_Wall = Make_Wall_Offset( BedRm_North_Wall, New_Length,
> > > New_Height, New_Thickness, Offset_Distance )
> >
> > Definitely not possible in POV-Ray, unless you write your own framework
> > (i.e. basically place another language on top of SDL) to do this sort of
> > things.
> >
> > > 2. Functions in a macro or that can get information from a macro
> > >    I would like to be able to perform actions on a declared object. For example
> > > instead of rotating and/or translating when they are created, these actions can
> > > be performed afterward for example
> > >    - #declare BedRm_North_Wall = Make_Wall( Length, Height, Thickness )
> > >    - BedRm_North_Wall_Rotate( angle )
> > >    - BedRm_North_Wall_Offset( offset_distance )
> >
> > you can define macros as:
> >
> >    #macro Rotate_Object(Obj,Angle)
> >      object { Obj rotate Angle }
> >    #end
> >
> > which you could then use like this:
> >
> >    #declare BedRm_North_Wall = Make_Wall( Length, Height, Thickness )
> >    Rotate_Object ( BedRm_North_Wall, angle )
> >    ...
>
> Supposing the object has been translated to <1500,8000,0> my guess is that the
> rotation you describe above will no longer work as expected. The wall has to be
> rotated when created at <0,0,0> before being moved. Right?

OK I think I see you have done what I am saying. Thanks.
It looks like for the first question I have to implement a go-between script.


Post a reply to this message

From: Chris B
Subject: Re: Enabling relative coordinate placement
Date: 20 Sep 2009 16:10:04
Message: <4ab68c1c@news.povray.org>
"Kene" <nomail@nomail> wrote in message 
news:web.4ab65a2cf8370660772dd76f0@news.povray.org...
> Hi:
>
> I am building a set of macros and hopefully functions that can assist an
> architect in making a building using POVRay. I understand that I cannot 
> export
> 2D technical sections of the resulting design but my hopes are that if I 
> can cut
> 3D sections of the building, then I can wait until POVRay can support the
> process more.

I've done a few similar things. I used a somewhat different approach some 
time ago, using Inkscape to draw floor plans in the SVG 2D vector graphics 
format. That uses POV-Ray macros to use the prism objects that Inkscape can 
export to create the corresponding buildings. See 
http://www.geocities.com/povstairs/povhouse/ for the sort of things it was 
able to do.

If you prefer to work directly in POV-Ray, you can certainly generate 
cross-sections through a building using CSG (as illustrated in the 
documentation accompanying the site above). For example, you could take a 
thin slice through a union of all the walls, place a flat plane beneath it 
(with a grid pattern drawn on it) and use an orthographic camera to 'draw' 
the floor plan.

> My hitch right now is that I cannot enable relative coordinate placement.
>
> It is important to be able to create an object relative to the position of
> another in architecture.


POV-Ray does have some features that make this sort of thing fairly 
straight-forward once you're familiar with the syntax and constructs. I 
wouldn't wish to overstate the ease with which this can be done as it's a 
lot of work, but your post implies that you're looking to invest a fair bit 
of time, so getting a straight-forward standardised approach at the outset 
is probably a good starting point.

One feature that I would consider important is the array syntax which allows 
you to store arrays of objects, text strings, transformations etc. The other 
is the 'transform' syntax which means you can easily store transformations 
and read them back later so that you can accumulate or reverse (inverse) 
them.

With a bit of careful design, you can set up an array to hold the component 
parts of the building, a corresponding array to hold the transformation and 
as many other arrays as you feel you need to index these two main arrays. 
One of the indexing arrays can hold the name of the component, so that, once 
declared, you can use the name of the object to refer to it instead of 
having to remember the indices. This also makes your code more readable. 
You can add other indexing information as you require, for example you could 
add an indicator to show if it's part of the walls, the roof, the floors or 
the furniture (a sort of 'category' classification).

To add a component you would call a macro that increments the array index, 
stores the object, the transformation, the component name and the category 
etc, passed in as parameters. You can create a simple macro to look up any 
previous transformation based upon the component name, so that you can 
position a component relative to any component that's already been declared. 
You can then have a set of macros to draw your chosen image, whether it be a 
3D perspective image or a 2D plan or section. These macros can decide what 
to include in the image based on the 'category' array, or on any other 
indexing information you choose to implement.

p.s. Once you get to the stage where you're adding detail, you may find the 
StairCase macro on the POV-Ray object collection at 
http://lib.povray.org/collection/staircase/chrisb%202.0/staircase.html 
handy, along with some of the other 'canned' architectural objects (chairs, 
tables etc.). Scroll down to see the staircases fitted inside a more complex 
architectural structure.


Regards,
Chris B.


Post a reply to this message

From: Darren New
Subject: Re: Enabling relative coordinate placement
Date: 20 Sep 2009 16:13:59
Message: <4ab68d07$1@news.povray.org>
Kene wrote:
> I am building a set of macros and hopefully functions that can assist an
> architect in making a building using POVRay. 

You might want to look at the LOME program I wrote
http://sourceforge.net/projects/lome/

It isn't SDL macros, but it generates SDL. It might be easier to start with 
a custom language that outputs SDL than to try to make SDL easy to use by an 
architect.

-- 
   Darren New, San Diego CA, USA (PST)
   I ordered stamps from Zazzle that read "Place Stamp Here".


Post a reply to this message

From: SharkD
Subject: Re: Enabling relative coordinate placement
Date: 20 Sep 2009 16:52:05
Message: <4ab695f5$1@news.povray.org>
Chris B wrote:
> I've done a few similar things. I used a somewhat different approach 
> some time ago, using Inkscape to draw floor plans in the SVG 2D vector 
> graphics format. That uses POV-Ray macros to use the prism objects that 
> Inkscape can export to create the corresponding buildings. See 
> http://www.geocities.com/povstairs/povhouse/ for the sort of things it 
> was able to do.

Only one more month and it will be gone!

-Mike


Post a reply to this message

From: Chris B
Subject: Re: Enabling relative coordinate placement
Date: 20 Sep 2009 17:59:10
Message: <4ab6a5ae$1@news.povray.org>
"SharkD" <mik### [at] gmailcom> wrote in message 
news:4ab695f5$1@news.povray.org...
> Chris B wrote:
>> I've done a few similar things. I used a somewhat different approach some 
>> time ago, using Inkscape to draw floor plans in the SVG 2D vector 
>> graphics format. That uses POV-Ray macros to use the prism objects that 
>> Inkscape can export to create the corresponding buildings. See 
>> http://www.geocities.com/povstairs/povhouse/ for the sort of things it 
>> was able to do.
>
> Only one more month and it will be gone!
>
> -Mike

Well I'm glad you pointed that out, I hadn't noticed that geocities was 
going.

Regards,
Chris B.


Post a reply to this message

From: Kene
Subject: Re: Enabling relative coordinate placement
Date: 21 Sep 2009 01:40:01
Message: <web.4ab710eeba1022f6772dd76f0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "Kene" <nomail@nomail> wrote in message
> news:web.4ab65a2cf8370660772dd76f0@news.povray.org...
> > Hi:
> >
> > I am building a set of macros and hopefully functions that can assist an
> > architect in making a building using POVRay. I understand that I cannot
> > export
> > 2D technical sections of the resulting design but my hopes are that if I
> > can cut
> > 3D sections of the building, then I can wait until POVRay can support the
> > process more.
>
> I've done a few similar things. I used a somewhat different approach some
> time ago, using Inkscape to draw floor plans in the SVG 2D vector graphics
> format. That uses POV-Ray macros to use the prism objects that Inkscape can
> export to create the corresponding buildings. See
> http://www.geocities.com/povstairs/povhouse/ for the sort of things it was
> able to do.
>
> If you prefer to work directly in POV-Ray, you can certainly generate
> cross-sections through a building using CSG (as illustrated in the
> documentation accompanying the site above). For example, you could take a
> thin slice through a union of all the walls, place a flat plane beneath it
> (with a grid pattern drawn on it) and use an orthographic camera to 'draw'
> the floor plan.
>
> > My hitch right now is that I cannot enable relative coordinate placement.
> >
> > It is important to be able to create an object relative to the position of
> > another in architecture.
>
>
> POV-Ray does have some features that make this sort of thing fairly
> straight-forward once you're familiar with the syntax and constructs. I
> wouldn't wish to overstate the ease with which this can be done as it's a
> lot of work, but your post implies that you're looking to invest a fair bit
> of time, so getting a straight-forward standardised approach at the outset
> is probably a good starting point.
>
> One feature that I would consider important is the array syntax which allows
> you to store arrays of objects, text strings, transformations etc. The other
> is the 'transform' syntax which means you can easily store transformations
> and read them back later so that you can accumulate or reverse (inverse)
> them.
>
> With a bit of careful design, you can set up an array to hold the component
> parts of the building, a corresponding array to hold the transformation and
> as many other arrays as you feel you need to index these two main arrays.
> One of the indexing arrays can hold the name of the component, so that, once
> declared, you can use the name of the object to refer to it instead of
> having to remember the indices. This also makes your code more readable.
> You can add other indexing information as you require, for example you could
> add an indicator to show if it's part of the walls, the roof, the floors or
> the furniture (a sort of 'category' classification).
>
> To add a component you would call a macro that increments the array index,
> stores the object, the transformation, the component name and the category
> etc, passed in as parameters. You can create a simple macro to look up any
> previous transformation based upon the component name, so that you can
> position a component relative to any component that's already been declared.
> You can then have a set of macros to draw your chosen image, whether it be a
> 3D perspective image or a 2D plan or section. These macros can decide what
> to include in the image based on the 'category' array, or on any other
> indexing information you choose to implement.
>
> p.s. Once you get to the stage where you're adding detail, you may find the
> StairCase macro on the POV-Ray object collection at
> http://lib.povray.org/collection/staircase/chrisb%202.0/staircase.html
> handy, along with some of the other 'canned' architectural objects (chairs,
> tables etc.). Scroll down to see the staircases fitted inside a more complex
> architectural structure.
>
>
> Regards,
> Chris B.

This is great! Exactly what I was looking for. It sounds like worth the effort
because I wanted to stay with the SDL as much as possible. I will investigate
this instead of creating a new program for now. I am also interested in your
method for floor plans.

I was starting a program that reads a custom SDL and draws simple shapes at the
right location using a split screen of TOP, FRONT and SIDE views as I type. Has
this been done before? I will come back to it later. I think that design is so
much more fun when you can type. Then exports to POVray SDL. Its just like
having a conversation if you know what I mean.

But first I need to get a handle on your idea. Thanks a million!


Post a reply to this message

Goto Latest 10 Messages Next 6 Messages >>>

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