POV-Ray : Newsgroups : povray.advanced-users : "Smart" objects Server Time
22 Dec 2024 17:58:08 EST (-0500)
  "Smart" objects (Message 1 to 2 of 2)  
From: Bald Eagle
Subject: "Smart" objects
Date: 30 May 2016 10:25:01
Message: <web.574c4c257539edc75e7df57c0@news.povray.org>
I've been mulling this idea over in my head for a while, and would like to get
some input from the community about how to go about implementing this.

I often use VISIO for drawing things out and modeling things in (mostly) 2D
before I go on to build them or model them in POV.

The idea here is that the shapes in VISIO are dynamic, and are parameterized and
integrated so that there can be some interplay between them and each other, or
the software, and thus make certain tasks easier.

The way I envision this working, is likely through the use of macros, where
rather than using object {} to place something in the scene, a macro is called,
which can return values to be handled in some way by the SDL.

So, just to throw a few ideas out there - lets suppose you want to position a
mirror so that you can see a reflection, or get a laser beam to reflect from one
place to another.
Calling macro Mirror (source, destination) with 2 vectors would calculate the
intersection point of the lines of sight, place a mirror there, turn it to the
correct angle, but then OUTPUT the location and angle for use elsewhere in the
SDL.   So something like:
 #declare MirrorArray[1] = Mirror (source, destination)
would not only place the mirror in the scene, but store the output in the array
being defined through the macro call.
(That was really hard to phrase clearly)

Or, let's say there's an object you'd like to see in a mirror, and you'd like to
place the camera in the/a "right" spot.
providing the macro with object location, mirror location, angle, and the
z-plane of the camera, it would return the x-y location for the camera and the
angle (since look_at is obvious)

Let's suppose I model something with "lines" or cylinders, but now I want to use
rectangular boxes instead.  I'd want an easy way to use the endpoints of the
line/cylinder and place a properly-sized box with the center of its faces at the
endpoints.  I'd also likely be interested in knowing the coordinates of the 8
box corners, the angle of the endpoint connecting line, and maybe the angles of
the box faces.

If you look at the way VISIO is set up, each "smart shape" has a "shape sheet"
which is like a spreadsheet with formulas in it.  Cells in those spreadsheets
can be referenced to get the calculated values for use elsewhere.  Turning on a
"label" flag in a parameterized POV-Ray macro could display a variable's value
as a text object in the scene, in the message window, or as a referenced string
in screen.inc .

If every such macro incremented a global OBJECT_ID variable in the host SDL,
then you could have a running list of objects, locations, and attributes output
to the message window.

I think that it might be interesting to explore this idea - it would allow much
faster generation of scenes that require careful placement of objects, would
allow quicker debugging, and I'm sure that all the clever folks here would
immediately launch off and start doing utterly unexpected an amazing things that
I would never have thought of.

Anyone interesting in playing with / developing this?

Thanks!


Post a reply to this message

From: clipka
Subject: Re: "Smart" objects
Date: 31 May 2016 11:36:58
Message: <574daf9a$1@news.povray.org>
Am 30.05.2016 um 16:20 schrieb Bald Eagle:

> The way I envision this working, is likely through the use of macros, where
> rather than using object {} to place something in the scene, a macro is called,
> which can return values to be handled in some way by the SDL.

I'm not sure I have much of a clue what you want to achieve, but I have
a hunch that it might be a project where the new 3.7.1 "tuple-style
assignment" may come in handy, which allows macros to return more than a
single value, like so:

    #macro Foo (Whatever)
      #local Result1 = ...;
      #local Result2 = ...;
      (Result1, Result2)
    #end

    #declare (Fnord1,Fnord2) = Foo(4711);

The values may even be of entirely different types.


Post a reply to this message

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