POV-Ray : Newsgroups : povray.advanced-users : Enabling relative coordinate placement : Re: Enabling relative coordinate placement Server Time
1 Jul 2024 05:28:33 EDT (-0400)
  Re: Enabling relative coordinate placement  
From: Chris B
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

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