 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Sabrina Kilian <ykg### [at] vt edu> wrote:
> > "Charles C" <nomail@nomail> wrote:
>My worry would be about files that are expecting to see a global variable by >one
name and get the prefixed version in
stead.
>
> nemesis wrote:
> > but the alias is given by the user of the include file in his own file. So,
> > the prefix is necessary and he is well aware of it, since it was him who
> > named it in the first place.
> >
>
> Everything in just bike.inc is prefixed with nem. If bike.inc includes
> another file, are those prefixed or not? If not, we run the risk of name
> overlap again because those items are probably going to be less likely
> to be checked. If they are, how will bike.inc know what variable names
> to call?
>
> Will #as tags stack like namespaces, or when a new one is created is the
> last one automatically closed?
Yes this is what I meant. I was just trying to say includes called from
within includes would need to inherit the prefixes all the way down. That
way, they'll all be expecting to see variables that match. The only issue
I see is for example things like #ifndef(something) #include
"something.inc" #end might tend to duplicate things in memory.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Charles C" <nomail@nomail> wrote:
> Yes this is what I meant. I was just trying to say includes called from
> within includes would need to inherit the prefixes all the way down.
In my "#declare whose" model above, I didn't address includes calling other
includes.
I've been thinking about how folks would actually be using includes. Naming
conflicts will occur. But, I don't think we need to make them idiot-proof,
just manageable. This is the possibility I imagine:
Think of each include file as a locked room. On the door of that room is a
sign that tells you what key you need to get in ( whose ). It tells you
what's in the room ( Manifest ). It tells you what rooms it leads to (
Dependencies ).
If you are already in possesion of an item with the same name as something
on the 'Manifest' and you don't want to loose it, then declare it as
something else before you go in. While you're at it, check the 'Manifests'
of the 'Dependencies' as well, renaming anything you have that you might
need to protect.
Then, make the key (#declare whose = "the_key") and enter (#include
"the_room.inc"). Once you're in the room your key might change (an include
file including another). But, that doesn't matter. You're already in the
room and you don't need any key to get out.
-Randall
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Okay, I'll admit that the "#declare whose" idea was a bit silly. And I'll
admit that some of my ideas are made of cork. But, I've just been getting
them out there so that we can all find the one made of tungsten.
This one might be just in that direction:
As long as we're asking the parser to rename macros and declares at the
front end (e.g. #include ... #as), couldn't we just ask the parser to
rename them for us in the Backend. And to do so in a way that none of us
possibly could with our keyboards? There are ascii values that are
unavailable to us when we name macros; but, couldn't we make them available
to the parser? This is what I have in mind:
Okay, let's say there are a few includes you want to use in your scene.
Let's call these "first-level includes." You're familiar with them already
or you wouldn't be using them. So, you're obviously going to be able to
avoid naming conflicts from items in those particular includes.
Now, assume that one or more of them also call includes. Let's call them
"second level." And, some of those includes might call still more - "third
level" - and so on. That's where you might run into a naming issue. Who
wants to have to read all those other files?
So, what if the parser could keep track of its 'include depth' and its
'include count' and then give it a renaming algorithm so that every macro
or declare 'call' in the first level and every macro or declare
'declaration' in the second level is altered identically - using
parser-only characters. Once in the second level each call is altered
uniformly and identically to each declaration at the third level and so on.
I realize that the #ifndef() at the front of each include may interfere with
this strategy. (User includes "A.inc" and "B.inc" and "A.inc" includes
"B.inc". Parser thinks "already been there" and doesn't give you what
"B.inc" has to offer you.) That needs to be addressed.
Admittedly, the parser is a black-box phenomenon to me. I have not looked
at its source. So, I have a question: Could this method result in strings
of redundant macro code called by different names taking up too much memory?
If so, would a sort of staging area of compilation be appropriate upon
exiting an include whenever it is one that has called includes itself?
Well, that's the best I've got for now.
-Randall
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Randall Sawyer" <sra### [at] yahoo com> wrote:
> But, I've just been getting
> them out there so that we can all find the one made of tungsten.
That's the whole point of this thread. And indeed perhaps none of them is
actually made of tungsten, but if we mix them in an alchemists way, we may
eventually get gold. :)
> some of those includes might call still more - "third
> level" - and so on. That's where you might run into a naming issue. Who
> wants to have to read all those other files?
No one wants naming conflicts: they are bad, very bad. That's why i
proposed having included items being local to the file including them. And
it really doesn't seem much difficult to make the parser handle it that way
and aliases.
> I realize that the #ifndef() at the front of each include may interfere with
> this strategy. (User includes "A.inc" and "B.inc" and "A.inc" includes
> "B.inc".
I believe such metaprogramming #ifdefs and whatnot should be in charge of
the parser, not the user. If includes are local, there should be no need
for them.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"nemesis" <nam### [at] gmail com> wrote:
> "Randall Sawyer" <sra### [at] yahoo com> wrote:
> > But, I've just been getting
> > them out there so that we can all find the one made of tungsten.
>
> That's the whole point of this thread. And indeed perhaps none of them is
> actually made of tungsten, but if we mix them in an alchemists way, we may
> eventually get gold. :)
>
> > some of those includes might call still more - "third
> > level" - and so on. That's where you might run into a naming issue. Who
> > wants to have to read all those other files?
>
> No one wants naming conflicts: they are bad, very bad. That's why i
> proposed having included items being local to the file including them. And
> it really doesn't seem much difficult to make the parser handle it that way
> and aliases.
>
> > I realize that the #ifndef() at the front of each include may interfere with
> > this strategy. (User includes "A.inc" and "B.inc" and "A.inc" includes
> > "B.inc".
>
> I believe such metaprogramming #ifdefs and whatnot should be in charge of
> the parser, not the user. If includes are local, there should be no need
> for them.
If you want the #declare of a sub-include to have local-status of a
current-level include, then that seems like it'd work just as long as the
#declare was meant to be used at a one-up level (one-up from the
sub-include). I've got a lot of stuff which I think this system would
break. It's seems hard to come up with a system that won't break
something.
How about different namespaces plain & simple, but with two additions: The
ability to define a global namespace, and the ability to combine
namespaces. If multiple namespaces are activated at once via a command
#namespace(Jake,Sam) the parser should automatically give an error if there
are conflicts. New #declares that are created when multiple non-global
namespaces are active will remain accessible to the individual namespaces.
#namespace (global) //brings scope up to global namespace only (default)
#include "colors.inc"
#namespace (Jake) //namespace Jake is defined and activated.
//global namespace is still accessible and therefore had better not conflict
with Jake.
#include "jakes_objects.inc"
#namespace (global) //brings scope up to global namespace only
#ifdef(jakes_doorknob)
#debug "huh? jakes_doorknob shouldn't be accessible now."
#end
#namespace (Jake) //switch back to jake's namespace as remembered by parser
#object{ jakes_doorknob pigment{White} }
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
From: "nemesis"
> No one wants naming conflicts: they are bad, very bad. That's why i
> proposed having included items being local to the file including them.
That's what I was getting at - "local to the file."
I've been thinking "Who uses POVRay?" and "What is POVRay script?"
At this time, my answers are:
"POVRay users are individuals with active visual imaginations who want
to share their visions with the world - whether it be artistic, scientific
or mathematical."
and:
"POVRay script is a descriptive language, functionally equivalent to
HTML. The ability for users to define functions and macros and pre-defined
objects are meant as a convenience. These features enable a user to produce
variations on a theme. They also enable the graphical analog to the DJ's
craft of recording original mixes of sampled prior works."
Although the added functionality of POVRay makes it seem like a programming
language, let's not treat it as such. I recently downloaded TrollTech's QT
4.2 C++ library. They have a slogan: "Code less. Create more." I like
that ethic. Good software - whether its for publishing, software
development or ray-tracing - is designed to meet the needs of its end-user.
It's along these lines I've been thinking. A lot of ideas in this threads
have been pointing in the direction of giving the user the ability to
manage naming conflicts themselves. But, what if the user doesn't want the
added responsibility. Then s/he might have a disincentive to use the new
extended includes library. Then the library is actually not going to be of
value to them.
So then I thought, what if we turn the direction of namespace management
responsibility around 180 degrees? What if you made it so that the names
of macros and declares written in the past were not allowed to conflict
with those of the future, while putting very little restriction on present
naming provided by the user. What I came up with is described in my last
posting.
Here are a few more details:
1) When a user defines a macro or a declare, s/he is limited to the
characters "0-9", "_", "a-z", "A-Z". That's only 63 out of 255 ascii
values.
2) Let's let the parser make use of the remainning ascii values to
internally rewrite includes, editting each 'declaration' and corresponding
'call' identically. A set of special characters "{(<,.#*>})..." will
most-likely have to be off-limits to the parser as well. I'm thinking
ascii 128-255 is free. (I am unfamiliar with the numbers for users who use
character codes other than ascii. But, I suspect the priciple will still
hold
true.)
3) By giving this unused subset of characters to the parser and an algorithm
with which to use it, the parser is essentially rewriting the past, renaming
macros and declares in a way that no user possibly could in the present.
This renaming occurs only once the includes are in the buffer. No include
files would actually be rewritten.
I hope I've shed some light on my line of thought. BTW: I started reading
the source code last night.
-Randall
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Charles C" <nomail@nomail> wrote:
> If you want the #declare of a sub-include to have local-status of a
> current-level include, then that seems like it'd work just as long as the
> #declare was meant to be used at a one-up level (one-up from the
> sub-include). I've got a lot of stuff which I think this system would
> break. It's seems hard to come up with a system that won't break
> something.
Yes, i can think of a clear example: global includes which are just meant
to include other files to files including it, like:
/* scene.pov */
#include "main.pov"
....
/* main.inc */
#include "foo.inc"
#include "bar.inc"
....
No big deal. Just #include them without #as and the original #include
behaviour should be the same. So:
#include "foo.inc"
makes all declared foo items available to whomever includes the current
file, while:
#include "foo.inc" #as foo
makes declared foo items local to this file and prefixed with the foo alias.
I took the as syntax from the python programming language imports, which are
java's one better. :)
I have a little problem with the "namespace" term: what does it mean to
someone who's not a programmer? Anyone can understand "include", not so
with "namespace". is it edible? :)
What to do? what to do? overload #include to handle more meanings? add
yet more specialized syntax? The former is C++ way, while the latter is
the Perl way and seeing how POV-Team members are knowledgeable in both, i
can't see what the future reserves... :)
Anyway, nice to see real efforts to bring the SDL a step further in design.
I hope the POV-Team pick some of our best efforts and give it a thought and
a spin.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Randall Sawyer" <sra### [at] yahoo com> wrote:
> I hope I've shed some light on my line of thought. BTW: I started reading
> the source code last night.
I would like to continue to clarify the naming model I am suggesting with
some vocabulary. This is my own vocabulary. If my idea has already been
implemented in some other application, and there is a pre-existing
vocabulary, then I would like to know that.
I am now thinking of files (include and renderable files both) in terms of
"spaces."
"Declaration Space":
The set of declares and macros defined in an include file.
"Implementation Space":
The set of code snippits which make use of any and all declares and/or
macros from a given include file. (Note: A file which calls more than one
include will have the same number of "implementation spaces".)
I am thinking of the set of named macros and declares - defined in an
include file - and those same macros and declares - implemented in a file
which calls that include file - in terms of a "membrane."
"Namespace Membrane":
A virtual structure implied by a single line in a file beginning with the
directive "#include ". On one side of the 'Namespace Membrane' is the
'Declaration Space' of the called include file. On the other side of the
same membrane is the 'Implementation Space' of the file containing the
'#include directive'.
I am thinking of the set of files (one renderable file, its includes, those
includes' includes, and so on) in terms of a tree - along the lines of a
'directory tree'. At the bottom is the renderable file - the single trunk
of the tree. Includes called by the renderable file are 'lower' and
includes called by other includes are 'upper' (as in branches).
"Upper Namespace Membrane":
Each include file has an 'Implementation Space' for each include file it
calls - thus implying the same number of 'namespace membranes'. (This
number may be zero (0) or positive.) Lets call each of these an "Upper
Namespace Membrane".
"Lower Namespace Membrane":
Every include file has exactly one "Lower Namespace Membrane". It is
implied each time the include file is '#include'd by another file.
[Note: The same include file may be called more than once in the same tree.
However, after being altered by the parser to avoid naming collisions, it
will have been transformed into a number of unique manifestations.]
An important rule to note:
In the model I propose, names are prevented from migrating from an 'upper
namespace membrane' to a 'lower namespace membrane' by virtue of the
parser's treatment of the file tree. Therefore, if your renderable file
'#include's "A.inc" - and - file "A.inc" '#include's "B.inc", then you
would not be able to access the 'declaration space' of "B.inc" unless your
file also includes "B.inc".
I hope this glorious mish-mash of metaphors is somewhat helpful in
communicating my vision. Next, I think I'll tinker with a C++ mock-up.
But, please stop me from just spinning my wheels if it turns out that's all
that I'm doing.
Thanks,
Randall
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I've had a look through this thread and there are a lot of ideas there.
There certainly seem to be some consistent themes emerging but before trying
to summarize them I'd like to clarify one point.
One large part of the thread discusses the potential to implement name
spaces in the POV-Ray parser and there are a couple of other ideas to
address naming conflicts and other issues that would require parser changes.
This seems great to me for the future, but it seems that if parser changes
are introduced then people are likely to take a while to get used to them
and start to develop techniques around them. Some time after that we would
be well positioned to discuss how to use them to implement standards.
I don't dispute that it would be good to anticipate such potential future
parser changes and build our current standards in a way that might be
compatible with them, but it seems to me that to get this collection off the
ground in the near future we'd be well advised to implement standards that
we're able to adhere to with existing versions of POV-Ray.
Would everyone be ok to limit the 'standards' discussion to existing, well
established features for now. This would also enable a greater number of
people to use the collection from the outset, without forcing everyone to
upgrade the moment the new version is released.
Regards,
Chris B.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Chris B" <c_b### [at] btconnect com nospam> wrote:
> Would everyone be ok to limit the 'standards' discussion to existing, well
> established features for now.
yeah, sure. Let's get back down to Earth and get the wheel moving! :)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Well here's my first attempt at summarising this thread. I've tried to pluck
out the ideas that we can do right now (i.e. that don't depend on parser
changes). I've selected what I think are the simplest of the ideas and built
them into what I'd propose as a cohesive starting point.
Some of the discussion points covered ideas that I think fit better into
'best practice' tutorials and guidance notes. I've set them aside for now,
but I think we should probably host such tutorials/guidance on the web site.
Some of the things that I've considered to be in this category include the
idea to have one object per file, positioning objects at the origin and 'y'
being 'up'.
Naming Conflicts
-----------------
I think the most important thing to address will be to avoid naming
collisions for files and identifiers. The simplest way of doing this will be
for contributions to adhere to naming standards based upon a name chosen by
the contributor. The name should be indicative of the content or purpose of
the contribution. Once a name has been chosen, no other contributions can
bear the same name, although clearly a particular contribution could be
changed almost beyond recognition over time by successive editors. Prefixes
will need to be used for file and identifier names (macros, variables,
functions etc).
The full contribution name could be used as the prefix. I think we should
also permit a shortened code to be used, but this would also need to be
unique.
Imagine someone creates a model of some cricket stumps and elects to name
the contribution 'CricketStumps'. If they wish to make use of a short code
and 'CS' has not already been used then they could register it. For this
example though, lets assume that 'CS' has already been allocated so they end
selecting 'CS2'.
Adherence to Naming Standards
---------------------------------
Use of the naming standards will be mandatory for contributions destined for
inclusion in the 'standard' part of the collection. As part of the
submission process the contributor will be required to indicate whether they
consider they have adhered to the standards. The contribution initially goes
into the 'ad-hoc' area. We could implement a 'feedback' screen where anyone
could comment on a contribution, with an option to dispute that a
contribution adheres to the standards.
If a contribution does adhere to the standards it could be promoted through
into the 'standard' area. Otherwise it will remain in the 'ad-hoc' area.
Such non-standard contributions would still be available for download, but
would be clearly 'marked' by the server to warn people that they don't
adhere to the standards (and to help prompt people to rectify the problem).
File Names
-----------
There's a limit on the number of directories we can declare in the library
path, so downloaded #include files and accompanying files will normally need
to go into just one directory - probably the include directory. Each of the
files from the collection that is going to end up in this directory will
therefore need to be uniquely named. Actually, I think that even if we use
an alternative directory or multiple directories in some way the names would
still need to be unique.
A contribution could contain multiple files, but all files in the
contribution will need to be made unique by using a common designated
prefix.
It probably be easiest to implement if the files all use the contribution
name as a prefix. This would make it easier for automated routines on the
server to manage parts of a contribution. The server could look for files
called:
o CricketStumps.html - as the top-level documentation file for the
contribution
o CricketStumps.keywords - for use with the search facility
o CricketStumps.pov - if present, could contain a simple renderable
example of the object
o CricketStumps.inc - would be the main include file and could also be
renderable
o CricketStumps.jpg - could contain a 800x600 render from which the server
could generate a thumbnail.
Other files could be included in the contribution, so, if the contribution
had its own separate texture file it could be called
CricketStumps_Textures.inc. None of these files would be mandatory, but if
not provided, the 'keywords' file would be created based on keywords entered
into the upload page when the collection is submitted.
If we permit an abbreviated prefix to be used then file names could become
CS2.inc, CS2_Textures.inc etc and the server would need to be able to
recognise that they are part of the same contribution. Maybe we'd have a
server generated file named CS2.CricketStumps to make the relationship
between the name and the prefix clear to a user looking through their
include directory.
If the contribution name needs to be followed by a descriptive name it
should be separated using an underscore e.g. CS2_Textures.inc or
CricketStumps_Textures.inc.
Does anyone know of any operating system of transfer software issues with
mixed case letters that may make it more sensible to use all lowercase file
names?
Identifier Names
----------------
In order that people will be able to use multiple contributions within a
single POV scene, identifiers declared in the include files will need to be
uniquely named so that they don't get mixed up with identifiers declared in
other include files from the collection and with those used in the scene
file.
The declaration of a variable intended to permit someone using the
CricketStumps contribution to set a height for some stumps may therefore
become '#declare CS2_StumpHeight = 0.85;'. Using an underscore here helps
anyone who may need to rename a set of identifiers in the future, for
example, anyone wishing to re-use a macro originally designed for
positioning cricket stumps within a future contribution for creating a
picket fence could readily rename identifiers.
Where an identifier does not need to be exposed to the person using the file
it should be declared using the #local directive.
Macro and Function Names
----------------------------
Similarly Macro names and function names will need to be unique, and would
need to be defined using the same unique prefix. e.g.
#macro CS2_CreateStumps (CS2_BailsOnFlag)
...
#end
Problematic File Types
-----------------------
It would be desirable to be able to permit non-SDL based utilities to be
added to the collection, such as conversion utilities, but if executable
files are permitted we should consider the potential question of viruses.
First step will be to check whether there's a virus scanner available to
povray.org to enable automated scanning of submitted files.
Sizing Standards
----------------
There was a discussion about whether people should be required to use a
standard size such as 1 POV-Ray unit = 1metre, but I think the consensus was
that this would difficult to apply universally because very large scale
(e.g. galaxies) and very small scales (atoms) can't reasonably adhere to
such a standard. Furthermore, someone who is accustomed to working in
Imperial measures could find it difficult to think in Metric.
I think the idea of documenting the units either in comments at the top of
the file or in the accompanying documentation was the best and simplest
idea. The contributor should also be encouraged to document the position and
size of their object and to include a sample scene file that people can look
at to easily work out how to get the object into the camera frame.
There was a proposal to have some generic unit conversion mechanism to allow
contributors to use the units they find most appropriate, while enabling
people to readily mix-and-match #include files.
This could be a macro or just some variable declarations and we could do
both very easily. I see Charles has started off a macro. We could also
create a standard #include file containing simple variable declarations
using a standard naming format:
#declare inches2metres = 0.0254;
#declare inches2feet = 1/12;
#declare miles2kilometres = 1.609344;
#declare feet2metres = 0.3048;
#declare metres2inches = 39.37007874;
#declare feet2inches = 12;
#declare kilometres2miles = 0.621371192;
#declare metres2feet = 3.280839895;
#declare lightyear2parsec = 0.306391546;
#declare parsec2lightyear = 3.263797626 ;
... etc ...
Then, if an object was defined in metres and we wanted it in feet we'd just
'scale metres2feet'.
We could even merge both ideas into a single include file, which could maybe
even find its way into the standard POV-Ray includes directory with V3.7 or
4.
Other Stuff
-----------
I'm sure that, over time, some clever people will develop utilities and
techniques to help improve standardisation of contributions, for example, a
parser to read a non-standard file and write out a standard one, ways of
wrapping non-standard code to make it look standard and changes to the
POV-Ray parser to introduce namespaces were all discussed.
If this all suits eveybody then I'd suggest that we plough ahead using an
approach that's as straight forward as possible to get this off the ground
and to see how it flies.
Anything I've missed, or that you disagree with?
Regards,
Chris B.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
in news:4587c656$1@news.povray.org Chris B wrote:
> There was a discussion about whether people should be required to use
> a standard size such as 1 POV-Ray unit = 1metre, but I think the
> consensus was that this would difficult to apply universally because
> very large scale (e.g. galaxies) and very small scales (atoms) can't
> reasonably adhere to such a standard. Furthermore, someone who is
> accustomed to working in Imperial measures could find it difficult to
> think in Metric.
>
Sorry, I wasn't able to follow all the discussions recently, so my
comment may have come up. Instead of standardising units why not require
a "small scale object" to fit in a centerd 1x1x1 pov-unit cube. Then any
user can scale the object to fit in a scene. For large scale objects one
could recuire it to fit in a 100x100x100 unit box. Or require that the
container for every object is defined in the #includefile (eventhough it
can be figured out using min/max_extent)
Thanks for the summary Chris.
Ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
ingo <ing### [at] tag povray org> wrote:
> Instead of standardising units why not require
> a "small scale object" to fit in a centerd 1x1x1 pov-unit cube. Then any
> user can scale the object to fit in a scene.
Btw, there's one thing to consider when predeclaring an object which is
later to be scaled:
Media density is not scaled with the object.
There are two possible behaviours of media density, both of which have
their rationale:
1) It is not affected by 'scale' (as it currently isn't). This is logical
when you think about an example case: If you have a glass of colored water,
it will filter light passing through it by some amount. If you take a glass
of the same colored water but which is twice as big, it will filter *more*
the light passing through it (because the light now traverses a larger
distance through the water). This is how POV-Ray currently behaves.
2) Density is affected by scale. This would be useful if you want to
eg. scale the entire scene to a different size, while keeping it looking
exactly the same. In other words, you might want to make everything 10 times
bigger (including the camera location etc), after which everything should
look identical, just all internal values are now ten-fold.
However, if you have an object with media in it, its density will currently
not be scaled, and you will end up with a much stronger media density, and
thus the object in question will look very different (with a 10 times
stronger media).
POV-Ray currently behaves as 1), but if you want the 2) behaviour, you'll
have to manually scale the media density by the inverse of the object scale
(IOW. if you scale the object 10 times bigger you have to divide the media
density by 10).
This consitutes a small problem with a predeclared object in an include
file which has media inside it. If you just instantiate the object and
scale it, and what you want is for the media to look identical regardless
of scale, that won't do it.
But on the other hand, you might *want* the media density to not to be
scaled with the object in order to get a more realistic result in certain
situations (think of the glass with colored water).
One possible solution to this is to make such objects #macros, one of
which parameters is the desired scale of the object. The macro will then
inversely scale the density of the media. This way if the user wants the
density to be scaled, he gives the scale as macro parameter, and if he
doesn't want it to be scaled, he just gives a "1" as scale parameter and
scales the object in his own code.
(Combinations of both are of course possible too, such as when you want
differently sized colored water glasses, but the base scale of the scene
is very different from what the original object was sized to.)
Of course uneven scaling is an interesting question in its own, but
let's not go that deep, shall we?
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Warp" <war### [at] tag povray org> wrote in message
news:45881636@news.povray.org...
>
> Btw, there's one thing to consider when predeclaring an object which is
> later to be scaled:
> Media density is not scaled with the object.
>
> ... snip ...
>
> One possible solution to this is to make such objects #macros, one of
> which parameters is the desired scale of the object. The macro will then
> inversely scale the density of the media.
>
> ... snip ...
>
> - Warp
That's something I wasn't aware of, but I have come across another situation
where scaling, rotating or translating a generated object was problematic
and ended up having to 'tell' the macro about any transformation that was
going to be applied so that it could take account of it during the
generation of the object (using an inverse of the transformation).
I think we should build such examples into part of a tutorial on how to make
objects reusable.
Regards,
Chris B.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Chris B <c_b### [at] btconnect com nospam> wrote:
> That's something I wasn't aware of, but I have come across another situation
> where scaling, rotating or translating a generated object was problematic
> and ended up having to 'tell' the macro about any transformation that was
> going to be applied so that it could take account of it during the
> generation of the object (using an inverse of the transformation).
Another feature which is not affected by transformations is the slope
pattern. However, I believe this to be a bug in POV-Ray which may be fixed
some time.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Warp" <war### [at] tag povray org> wrote in message
news:4588219a@news.povray.org...
> Chris B <c_b### [at] btconnect com nospam> wrote:
>> That's something I wasn't aware of, but I have come across another
>> situation
>> where scaling, rotating or translating a generated object was problematic
>> and ended up having to 'tell' the macro about any transformation that was
>> going to be applied so that it could take account of it during the
>> generation of the object (using an inverse of the transformation).
>
> Another feature which is not affected by transformations is the slope
> pattern. However, I believe this to be a bug in POV-Ray which may be fixed
> some time.
>
> --
> - Warp
Hmm. So some sort of 'health warning' in a tutorial would probably be in
order for that one :o)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"ingo" <ing### [at] tag povray org> wrote in message
news:Xns989EACFFCF424seed7@news.povray.org...
> in news:4587c656$1@news.povray.org Chris B wrote:
>
>> There was a discussion about whether people should be required to use
>> a standard size such as 1 POV-Ray unit = 1metre, but I think the
>> consensus was that this would difficult to apply universally because
>> very large scale (e.g. galaxies) and very small scales (atoms) can't
>> reasonably adhere to such a standard. Furthermore, someone who is
>> accustomed to working in Imperial measures could find it difficult to
>> think in Metric.
>>
>
> Sorry, I wasn't able to follow all the discussions recently, so my
> comment may have come up. Instead of standardising units why not require
> a "small scale object" to fit in a centerd 1x1x1 pov-unit cube. Then any
> user can scale the object to fit in a scene. For large scale objects one
> could recuire it to fit in a 100x100x100 unit box. Or require that the
> container for every object is defined in the #includefile (eventhough it
> can be figured out using min/max_extent)
>
> Thanks for the summary Chris.
>
> Ingo
Hi Ingo,
I think it was touched on in the thread, but I don't think it was discussed
in detail.
Personally I think this would make life more complicated rather than less.
When I think of my POVPerson macros which generate characters of different
sizes in different poses, if the macro scaled a 6ft tall seated person to
fit in a fixed sized unit cube and then, on a second call to the macro it
scaled a 5ft 4in standing person to fit in the same sized cube, I think it
would make the characters quite difficult to use. The person using them
would have to scale them up again by some quite difficult to calculate
amounts to be able to use them together.
Even with something as simple as a cricket ball, you'd have to know the size
of a cricket ball to scale it back to a realistic size if you just get a
unit sized ball, whereas, if it's in a recognised unit of measure you'd
probably be able to guess which conversion you need without even reading the
accompanying documentation. IMO if you had a ball in metres and a set of
cricket stumps in feet I think this would still be easier to work with than
if you got them both scaled to fit in a unit square.
As soon as you get larger collections of objects I think the problem would
grow. If each was scaled to a unit cube, then scaling them all by different
amounts to get them to work together seems to me like it would be a real
pain.
Regards,
Chris B.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
ingo <ing### [at] tag povray org> wrote:
> comment may have come up. Instead of standardising units why not require
> a "small scale object" to fit in a centerd 1x1x1 pov-unit cube. Then any
> user can scale the object to fit in a scene.
Yes, i've come up with that earlier, i think in another thread. It makes a
lot of sense to me and i feel glad that someone else also likes the idea.
:)
I've been busy these days, and since Christmas is close, i don't think i'll
have much time for these lengthy discussions. How about saving it for
January? :)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |