POV-Ray : Newsgroups : povray.advanced-users : Object Oriented POV code Server Time
21 Nov 2026 20:08:48 EST (-0500)
  Object Oriented POV code (Message 151 to 179 of 179)  
<<< Previous 50 Messages Goto Initial 50 Messages
From: Warp
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 05:30:30
Message: <403b27c6@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Warp wrote:
> >   So because the makers of the compiler are lazy they force the
> > user of the language to make bad code?

> Correctamundo! Welcome to commercial programming!

  If I'm not completely mistaken this thread was about what would be
useful features and what would be unnecessary features for a theoretical
future OO scripting language for POV-Ray.
  Last time I checked POV-Ray was not commercial and the developers didn't
have really tight deadlines.

> >   C++ does multiple inheritance quite efficiently, and even if it didn't,
> > why should it matter? You just need to know how heavy multiple inheritance
> > is and then decide whether to use it or not in your application.

> Spoken like someone who writes all his own code without using someone 
> else's libraries. Very good. :-)

  I do use someone else's libraries a lot. For instance, I use the STL
libraries in almost every single C++ program I make. I do know most of
the advantages and disadvantages (including bottlenecks) in them.

> >   One could argue that virtual functions are inefficient because they
> > produce internally an indirect function call (subroutine call to an
> > address got from behind a pointer got from behind a pointer), which
> > potentially make them slightly slower than regular function calls.

> Of course, that assumes the compiler's too stupid to turn this into a 
> direct call in the case that there's no actual dynamic dispatch in the 
> program. Same kind of thing. Lazy compiler writers. ;-)

  If a member function has been declared virtual in C++, there's no way
the compiler can know at compile time there will be no more than one
derived class implementing that function. It can't even theoretically
check this at linking time because some code in a dynamic library (which
may change in the future) may implement that virtual function.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 05:32:38
Message: <403b2846@news.povray.org>
Christopher James Huff <cja### [at] earthlinknet> wrote:
> >   I can't see interfaces as anything else than very limited classes.

> Because you're stuck in thinking about things in terms of C++...I think 
> it'd help you to learn a few more object-oriented languages.

  Actually I was thinking in terms of Java. My comment was in no way
related to C++.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 05:35:48
Message: <403b2904@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> You asked why one would forbid multiple inheritance. The ones doing the 
> forbidding are the compiler writers. Hence, the answer is from a 
> compiler-writer's point of view. Compiler-writers don't *use* multiple 
> inheritance. They *implement* it.

  That's exactly my point.
  The fact that implementing multiple inheritance in a compiler is
laborious shouldn't be a good-enough reason for depriving the user of
the compiler from the possibility of using multiple-inheritance for
something useful.
  It's a bit like "sorry, I don't know how to implement function calls
in my compiler, so you'll just have to make your code without function
calls". Not acceptable. :)

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 05:38:43
Message: <403b29b3@news.povray.org>
Christopher James Huff <cja### [at] earthlinknet> wrote:
> Of course, this is basically doing what language-level 
> constant references would do, and isn't much simpler...

  Exactly my point. :)

> >   That doesn't mean it shouldn't be made secure.

> It does mean it should be made as simple as feasible. Lack of constants 
> hasn't done much harm in POV-Ray.

  This is because you can pass things by value and because there isn't
really any modules with a state (which you could break by accident).
But as soon as you introduce modules (which work like libraries) you
need some security features to avoid the user breaking their functionality
by accident.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 13:10:31
Message: <403b9397@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Warp wrote:
> >   If I'm not completely mistaken this thread was about what would be
> > useful features and what would be unnecessary features for a theoretical
> > future OO scripting language for POV-Ray.

> Yet, just 2 posts up, you said
> >   For example, in Java I see two types of classes: The regular ones
> > and the extremely limited ones which they call "interfaces".
> >   What I wonder is why have two types of classes like this when just
> > one type suffices? IMO interfaces cause more problems than they avoid.

> You need to learn to stay on topic. ;-)

  I don't understand where I went off-topic.

  I said that I don't like Java interfaces and I don't understand why
there needs to be any. So IMO this new scripting language doesn't need
any interfaces á la Java.

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 13:32:22
Message: <cjameshuff-532B03.13330824022004@news.povray.org>
In article <4032b303$1@news.povray.org>,
 Tom Melly <pov### [at] tomandlucouk> wrote:

> IMHO this comes down to 'pov ain't oo' - I don't think anyone denies 
> that oo capabilities in pov wouldn't be at the very least interesting, 
> but that's not the issue....

Now, what was that you were saying anyway? I never figured out if you 
thought OO capabilities were interesting or not...though this thread 
makes it clear that at least some people consider them to be of great 
interest. It's almost at the 200 message mark...

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 13:35:28
Message: <cjameshuff-6988E8.13361424022004@news.povray.org>
In article <403b2846@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   Actually I was thinking in terms of Java. My comment was in no way
> related to C++.

I meant that you're looking at Java in terms of C++, by considering 
interfaces to be multiply-inherited, limited classes.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Andreas Kaiser
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 18:22:31
Message: <cein30d8ns00bhov48dfslvkbjko83t8d5@4ax.com>
On Sun, 22 Feb 2004 01:11:47 -0800, Tek wrote:

(Just a hint: start a new thread "Cast operators are evil" and I'll
agree at once)

>My point is that a+b takes a different length of time according to the types of
>a and b, where as MyMatrixAddFunction(a,b) takes the same length of time always,

I don't know what you want to state above. I think everybody will
agree that adding two matrices will take more time than adding two
integers. An operator adding two matrices takes the same time as your
MyMatrixAddFunction() function.
 
>plus you can search for it to see where it's executed in the code,

Ok, this might by an advantage.

>plus you can
>stick a nice big comment on the prototype of it saying "//avoid calling this
>unless really necessary, it's very slow" so that anyone who doesn't know how to
>add these two things has to look up the function prototype and read the comment
>and reconsider the code they're writing.

If someone is new to the project (as he doesn't know how to add 'these
two things') you have to train him anyway.
Using appropriate operators is IMHO more intuitive (and as fast as
your My...Function() above).

>I'm not trying to suggest the source looks nicer with more function calls, it
>certainly doesn't. I'd even say I like operator overloading a lot, it's
>extremely useful in high-level programming applications. I'm merely saying that,
>in practice, it makes it easier to write code that is much more complex to
>execute than it is to read or write. This is both it's strongest and weakest
>point.

I don't get the point. All that I know if I see 'My...Function(a, b)'
in the code is "Either a or b, or both of them are not simple types",
it doesn't give me any hint/warning about it's complexity.

>> The macros required to do trivial colour/vector arithmetic are
>> 'information hiding' in the worst sense. They blow up source code and
>> add visual noise which makes it sometimes almost impossible to see
>> what's going on.

>As I said, I support using + for vectors since that's what it will compile to.
>Although I don't really see your point about visual noise, function calls

Think of the core steps of an algorithm as signal, the code you
write/read as noise.

>certainly make it harder to write clearly readable code but since it's harder
>all it takes is more effort.

Yes. Harder to write it once, *and*
- harder to read always,
- harder to find bugs,
- easier to hide bugs,...

>Programming isn't about making things easier for
>the programmer, it's about making the end result better. In application software
>or high level programming these two ideas are very compatible, but in time
>critical stuff like game engines people like me have to give ourselves headaches
>trying to optimize out one cycle in a render loop in order to improve the
>performance of the game. Operator overloading hinders us in this quest.

>Damn that made me sound so cool...

:-)

-- 
Andreas


Post a reply to this message

From: Andreas Kaiser
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 19:05:38
Message: <06nn30d5mm6n9obft2tquhgr82le6s4jok@4ax.com>
On Sun, 22 Feb 2004 12:33:36 -0500, Christopher James Huff wrote:

>In article <n8ag309hemfhpmj8jnt5j5s3k8gr66rm62@4ax.com>,
> Andreas Kaiser <aka### [at] nurfuerspamde> wrote:
>
>> This might be a 'learning' problem if you aren't aware of the
>> operators 'hidden' complexity. 
>
>Only if the code is poorly designed. You shouldn't have to care about 
>the hidden complexity. It doesn't matter one bit how the = operator 
>copies a string, only that it does so.

This was meant from a newbie's point of view where 'a *= b' might
appear to be faster than a call to 'MyMatrixMultiplyMatrixEq(a, b)'.

>> >So do functions.
>> 
>> Yes, same problem here. There's no correlation between length of
>> function name and complexity. 

Oh, I see, I forgot the smiley.
Please read it as "... 'problem' ...".

>It's not a problem. It's a feature. Code written without functions is 
>called spaghetti code, it ain't pretty and it is very inefficient and 
>unmaintainable. Or should functions that do more have longer names?

This is what I wanted to point out.

> How long should POV-Ray's main() function be?

As short as possible.

-- 
Andreas


Post a reply to this message

From: Ken
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 22:17:32
Message: <403C146F.38604E10@tag.povray.org>
Christopher James Huff wrote:

> though this thread
> makes it clear that at least some people consider them to be of great
> interest. It's almost at the 200 message mark...

I am still unconvinced that the greater majority will be served by the
addition of OO capabilities. I see a handful of dedicated programmers
in this discussion discussing what makes a program OO compliant but the
average joe-blow POV-Ray user is conspicuously absent in this discussion.

How much program bloat will it add and how many people will be served by
it? If it's just to provide a new toy, for a few dedicated programming
enthusiasts, rather than to act as a significant improvement for the
mainstream user, I don't think it is worth the effort.

-- 
Ken Tyler


Post a reply to this message

From: Christopher James Huff
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 22:30:49
Message: <cjameshuff-01630D.22313524022004@news.povray.org>
In article <403C146F.38604E10@tag.povray.org>,
 Ken <ken### [at] tagpovrayorg> wrote:

> How much program bloat will it add and how many people will be served by
> it? If it's just to provide a new toy, for a few dedicated programming
> enthusiasts, rather than to act as a significant improvement for the
> mainstream user, I don't think it is worth the effort.

Honestly, it won't add much bloat. And everyone who uses POV will be 
served by it, even if they don't use the features directly. It would 
make it easier for the programmer types to create extensions for POV 
(lens flares, for example), and make those extensions easier to use.

About the bloat issue: actually, it would be a good idea to replace the 
parser completely rather than trying to wedge OO features into this one, 
in which case the result could be much faster and more efficient than 
the present parser. And remember that non-programmers do use the work 
that programming enthusiasts create. The main point of object 
orientation is to make it possible to have a simple way to use complex 
things, without caring about the guts.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Tek
Subject: Re: Object Oriented POV code
Date: 24 Feb 2004 23:40:44
Message: <403c274c$1@news.povray.org>
Okay, you obviously don't understand my point, so I'll try to come at it from a
different angle:

I'm sure you would agree there are some applications for which assembler is
better suited than smalltalk, right?

One is basically the lowest level of coding, the other is more or less the
highest.

But, most people don't use either! That's because both extremes have problems
caused by being too low level, or too high level.

All that I'm saying is that in my experience the games industry likes to be at a
slightly lower level than C++. Overloaded operators are one of the things we
prefer to do in the low-level way rather than the high-level way.

Obviously it compiles to the same code but so do all high level languages, it
all ends up as assembler in the end. It's just a question of what level you wish
to think & code at.

-- 
Tek
www.evilsuperbrain.com


Post a reply to this message

From: Hughes, B 
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 01:20:51
Message: <403c3ec3$1@news.povray.org>
I heard Ken saying "average joe-blow" wasn't participating in this long
discussion, so I'm here.

"Christopher James Huff" <cja### [at] earthlinknet> wrote in message
news:cjameshuff-01630D.22313524022004@news.povray.org...
> make it easier for the programmer types to create extensions for POV
> (lens flares, for example), and make those extensions easier to use.

I guess it could be, if I followed any of this talk at all.

> in which case the result could be much faster and more efficient than
> the present parser. And remember that non-programmers do use the work
> that programming enthusiasts create. The main point of object
> orientation is to make it possible to have a simple way to use complex
> things, without caring about the guts.

Simple can be good, but... What I'm imagining happening is that a simple
sphere might look like:

ThisSphere.sphere {<1,2,3>,1}

And continued usage (adding a color for example):

ThisSphere.color {<0.1,0.2,0.3,1,0>}

Where MySphere remains defined but gets additional info attached to it. Or
all at once:

ThisSphere.sphere.color {<1,2,3>,1,<0.1,0.2,0.3,1,0>}

Then raytraced when only the name stands alone:

ThisSphere

And so it's difficult to think of doing this for evermore complicated
things. Am I on the wrong track to believe this way? Such as, perhaps, Ken
has too? Apologies if I've gone astray but I had to reread much of this
thread again and i still am unsure of the potential OO-like SDL has, good or
bad.

Bob H.


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 04:34:50
Message: <403c6c39@news.povray.org>
Tek <tek### [at] evilsuperbraincom> wrote:
> My point is that a+b takes a different length of time according to the types of
> a and b, where as MyMatrixAddFunction(a,b) takes the same length of time always,

  I would like to see a MyMatrixAddFunction() which adds two matrices
together and which takes the same length of time independently of how
big the matrices given as parameters are.
  That's a big like claiming that std::sort() always takes the same length
of time (even if you use it only with one type of parameters).

  Besides, it's not 100% sure that a function called "MyMatrixAddFunction()"
will always take the same amount of time because you can overload that
function name to do something else with some other types (in the exact
same way you can overload operators to do that).

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 04:45:04
Message: <403c6ea0@news.povray.org>
Ken <ken### [at] tagpovrayorg> wrote:
> I am still unconvinced that the greater majority will be served by the
> addition of OO capabilities.

  They will.

  Learning to program OO programs is not the only way of benefiting from it.
It's obvious that if POV-Ray had a full-featured object-oriented scripting
language, only a few percentage of POV-Ray users would learn to use it at
its full strength.
  However, that doesn't mean only this small percentage will benefit from it.

  Having a good, full-featured OO language means that those hc programmers
can make better libraries which are more powerful and very easy to use.
If designed correctly, everyone can use these libraries without much
effort or learning, thus indirectly benefiting from the power of the
language.

  Think of it like this: You don't need to know how your fully graphical
operating system works internally: The hc programmers which made that OS
have already figured out the difficult parts for you and made a simple
user interface for you to benefit from these properties. Even though
you may not know how to program hardware and other types of low-level
things, you still are indirectly benefiting from it because someone else
made an easy-to-use interface to use it.
  However, these few hc programmers need the tools to make their programs.
If they don't have the tools, then everyone is on their own.

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 08:25:49
Message: <cjameshuff-625719.08263725022004@news.povray.org>
In article <403c3ec3$1@news.povray.org>,
 "Hughes, B." <omn### [at] charternet> wrote:

> > make it easier for the programmer types to create extensions for POV
> > (lens flares, for example), and make those extensions easier to use.
> 
> I guess it could be, if I followed any of this talk at all.

For example, being able to make a lens flare object that you can 
translate around, put in a CSG, etc.


> Simple can be good, but... What I'm imagining happening is that a simple
> sphere might look like:
> 
> ThisSphere.sphere {<1,2,3>,1}

That wouldn't be any syntax I recognize. It could easily end up looking 
like:
def ThisSphere = sphere {<1,2,3>,1}


> And continued usage (adding a color for example):
> 
> ThisSphere.color {<0.1,0.2,0.3,1,0>}

ThisSphere.pigment.color = <0.1,0.2,0.3,1,0>;


> Where MySphere remains defined but gets additional info attached to it. Or
> all at once:
> 
> ThisSphere.sphere.color {<1,2,3>,1,<0.1,0.2,0.3,1,0>}

def ThisSphere = sphere {<1,2,3>, 1 pigment {<0.1,0.2,0.3,1,0>}}

The dot syntax is just about always used for accessing parts of an 
object, not for creating one. Like vector .x, .y, .z, or color .red, 
.green, etc.


> Then raytraced when only the name stands alone:
> 
> ThisSphere

There's several ways adding the object to the scene could be handled, 
this is one way.


> And so it's difficult to think of doing this for evermore complicated
> things. Am I on the wrong track to believe this way?

Yes. You're assuming you would have to do everything in a much more 
complex fashion, this is not the case. The final result could be very 
similar to the current POV language in general use.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 08:32:05
Message: <cjameshuff-CBE968.08325325022004@news.povray.org>
In article <06nn30d5mm6n9obft2tquhgr82le6s4jok@4ax.com>,
 Andreas Kaiser <aka### [at] nurfuerspamde> wrote:

> This was meant from a newbie's point of view where 'a *= b' might
> appear to be faster than a call to 'MyMatrixMultiplyMatrixEq(a, b)'.

And I've seen people ask if functions and variables with longer names 
were slower to access (in C++), I've even seen code with shortened names 
to maximize speed...but this kind of newbie misconception shouldn't last 
long, and is no argument against operator overloading.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 08:44:25
Message: <cjameshuff-DF3DAB.08451225022004@news.povray.org>
In article <403b27c6@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

> > Of course, that assumes the compiler's too stupid to turn this into a 
> > direct call in the case that there's no actual dynamic dispatch in the 
> > program. Same kind of thing. Lazy compiler writers. ;-)
> 
>   If a member function has been declared virtual in C++, there's no way
> the compiler can know at compile time there will be no more than one
> derived class implementing that function.

However, there are cases where the compiler can figure out which 
inherited implementation is desired and turn a member function call into 
a static call, or even inline it. Pretty much whenever the exact type of 
the object being referred to is known.


> It can't even theoretically
> check this at linking time because some code in a dynamic library (which
> may change in the future) may implement that virtual function.

C++ doesn't play particularly well with dynamic linking. C++ RTTI and 
virtual functions can cause many problems with it.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 08:45:14
Message: <cjameshuff-CF710D.08460225022004@news.povray.org>
In article <403b9397@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   I don't understand where I went off-topic.
> 
>   I said that I don't like Java interfaces and I don't understand why
> there needs to be any. So IMO this new scripting language doesn't need
> any interfaces á la Java.

And that's where you keep going off topic. We're not talking about Java 
interfaces, we're talking about interfaces.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Hughes, B 
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 16:06:25
Message: <403d0e51$1@news.povray.org>
"Christopher James Huff" <cja### [at] earthlinknet> wrote in message
news:cjameshuff-625719.08263725022004@news.povray.org...
> In article <403c3ec3$1@news.povray.org>,
>  "Hughes, B." <omn### [at] charternet> wrote:
>
> > Where MySphere remains defined but gets additional info attached to it.
Or
> > all at once:
> >
> > ThisSphere.sphere.color {<1,2,3>,1,<0.1,0.2,0.3,1,0>}
>
> def ThisSphere = sphere {<1,2,3>, 1 pigment {<0.1,0.2,0.3,1,0>}}
>
> The dot syntax is just about always used for accessing parts of an
> object, not for creating one. Like vector .x, .y, .z, or color .red,
> .green, etc.

Ahh yes, thanks for that clarification. I suspected as much but it was
looking to me like everything was to be built in the same way as accessing
it later.

> > Then raytraced when only the name stands alone:
> >
> > ThisSphere
>
> There's several ways adding the object to the scene could be handled,
> this is one way.

I like not having to use object {ThisSphere}, so this is a good thing I
think. Minimized scripting in the same vein as not needing parent wrappers,
which I believe you actually mentioned back in the thread someplace, could
be nice. Maybe not clear until learning what's what, but easier to write.

> > And so it's difficult to think of doing this for evermore complicated
> > things. Am I on the wrong track to believe this way?
>
> Yes. You're assuming you would have to do everything in a much more
> complex fashion, this is not the case. The final result could be very
> similar to the current POV language in general use.

Okay. But, admittedly, it would still become more code-like for the writers
of it. Yet, presumably, easier to use the result. Regardless, I think all
this will come down to a widened dividing line between casual artists and
data-crunchers. Since no one knows the future for certain it could go either
way, good or bad thing. Maybe no worse than other changes had been. Hmmm...
That's a statement not to be taken too lightly. The halo, semicolons,
patterns... sounds ultra mild compared to most of the talk in this thread.
;-)

Bob H.


Post a reply to this message

From: Christopher James Huff
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 16:59:25
Message: <cjameshuff-6C16F7.17001225022004@news.povray.org>
In article <403d0e51$1@news.povray.org>,
 "Hughes, B." <omn### [at] charternet> wrote:

> Ahh yes, thanks for that clarification. I suspected as much but it was
> looking to me like everything was to be built in the same way as accessing
> it later.

You could create a language in such a way, but it would be quite 
strange...actually, JavaScript is a little similar. But none of the 
syntaxes I've seen suggested for POV would do it this way.


> I like not having to use object {ThisSphere}, so this is a good thing I
> think. Minimized scripting in the same vein as not needing parent wrappers,
> which I believe you actually mentioned back in the thread someplace, could
> be nice. Maybe not clear until learning what's what, but easier to write.

I think you might be referring to my "#declare MyObj = object {MyObj 
translate...}" example. I would actually prefer some kind of wrapper, 
though maybe not of that exact form. Something like:

scene {
    MyObj;
    AnotherObj;
    AndAnotherOne;
    SomeProcedureThatReturnsAnObject();
    ObjectMaker.MakeAnObject();
}

Basically, any statement that results in an object puts an object into 
the scene when used within a scene {} block. Outside a scene block, the 
object just gets ignored. Otherwise you'll run into annoyances when you 
call something that returns an object that is only desired some of the 
time. Say you have a procedure that does something to an object and 
returns that object for convenience, but you sometimes need to call it 
but don't need the returned object. Without the scene{} block 
restriction, you'd have to do something like declare a dummy variable 
just to hold the object you don't want...annoying.
I also think it makes things a bit clearer to have some kind of wrapper 
for the object name.


> > Yes. You're assuming you would have to do everything in a much more
> > complex fashion, this is not the case. The final result could be very
> > similar to the current POV language in general use.
> 
> Okay. But, admittedly, it would still become more code-like for the writers
> of it. Yet, presumably, easier to use the result.

Well, it won't make the internals of a lens flare system any easier for 
non-coders to understand, but it will make it easier for them to use it. 
Objects are typically seen as "black boxes", they can be very complex 
inside but nobody has to care about that, they only use the stuff on the 
outside.


> Regardless, I think all this will come down to a widened dividing 
> line between casual artists and data-crunchers.

I don't think so. It will mean more is possible entirely within POV 
script, so the "data crunchers" won't have to go to external tools, and 
the casual users have a much shorter distance to go before they can 
understand and create similar things. POV-artists and POV-coders, rather 
than POV-artists and C++/Java/Python-coders-who-export-POV-code.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Hughes, B 
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 18:18:34
Message: <403d2d4a$1@news.povray.org>
"Christopher James Huff" <cja### [at] earthlinknet> wrote in message
news:cjameshuff-6C16F7.17001225022004@news.povray.org...
> In article <403d0e51$1@news.povray.org>,
>  "Hughes, B." <omn### [at] charternet> wrote:
>
> > I like not having to use object {ThisSphere}
>
> I think you might be referring to my "#declare MyObj = object {MyObj
> translate...}" example. I would actually prefer some kind of wrapper,
> though maybe not of that exact form. Something like:
>
> scene {
>     MyObj;
>     AnotherObj;
>     AndAnotherOne;
>     SomeProcedureThatReturnsAnObject();
>     ObjectMaker.MakeAnObject();
> }
>
> Basically, any statement that results in an object puts an object into
> the scene when used within a scene {} block. Outside a scene block, the
> object just gets ignored. Otherwise you'll run into annoyances when you
> call something that returns an object that is only desired some of the
> time.
---snip---
> I also think it makes things a bit clearer to have some kind of wrapper
> for the object name.

Yes, I can see the reasoning here. This whole discussion, of what I didn't
skip anyway, was causing my mind to wander and think about it being possible
to write a piece of the SDL likened to the way a #macro() is now but with
far more interaction. And so, in that way, I thought of it as allowing for
subsets of a new kind of SDL which are callable at any time; same as the
program code itself. Maybe the term would be soft-code rather than
hard-code. From that idea I could see it as not needing every designation
such as would be if a material{} had to always be written out in full for a
simple color.

Anyway, I think I'm understanding it better now that I spoke up. It surely
is of the realm of programming before the final usage could come into play.
But I feel I've backtracked here by rehashing what's probably already been
said.

Bob H.


Post a reply to this message

From: Christopher James Huff
Subject: Re: Object Oriented POV code
Date: 25 Feb 2004 21:25:52
Message: <cjameshuff-5F397F.21264025022004@news.povray.org>
In article <cjameshuff-DF3DAB.08451225022004@news.povray.org>,
 Christopher James Huff <cja### [at] earthlinknet> wrote:

> > It can't even theoretically
> > check this at linking time because some code in a dynamic library (which
> > may change in the future) may implement that virtual function.
> 
> C++ doesn't play particularly well with dynamic linking. C++ RTTI and 
> virtual functions can cause many problems with it.

I forgot to mention it, but you might want to look up "fragile base 
classes".

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Tek
Subject: Re: Object Oriented POV code
Date: 26 Feb 2004 00:09:17
Message: <403d7f7d$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message news:403c6c39@news.povray.org...
>   That's a big like claiming that std::sort() always takes the same length
> of time (even if you use it only with one type of parameters).

What I mean is that "+" should always take the same length of time, and should
not be confused with something that will take a different length of time.

Though I'm tired of repeating myself. If you disagree with me that's fine, but
you still seem to misunderstand what I'm saying, and I've got tired of
explaining.

Honestly I was just trying to point out we don't do this in the games industry,
not start a debate based on confusion...

-- 
Tek
www.evilsuperbrain.com


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 26 Feb 2004 05:26:40
Message: <403dc9e0@news.povray.org>
Christopher James Huff <cja### [at] earthlinknet> wrote:
> And that's where you keep going off topic. We're not talking about Java 
> interfaces, we're talking about interfaces.

  So what's the difference between Java interfaces, your interfaces and
abstract classes?

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 26 Feb 2004 05:27:58
Message: <403dca2d@news.povray.org>
Christopher James Huff <cja### [at] earthlinknet> wrote:
> > > It can't even theoretically
> > > check this at linking time because some code in a dynamic library (which
> > > may change in the future) may implement that virtual function.
> > 
> > C++ doesn't play particularly well with dynamic linking. C++ RTTI and 
> > virtual functions can cause many problems with it.

> I forgot to mention it, but you might want to look up "fragile base 
> classes".

  But I was not talking about changing base classes. I was talking about
changing derived classes. There's a big difference.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 27 Feb 2004 04:03:57
Message: <403f07fd@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> I mean, Java interfaces are specific to Java, generic interfaces aren't, 
> and abstract classes can actually have code and stuff in them and Java 
> doesn't support that. Why do you ask?

  That doesn't really tell what these "generic interfaces" are, and how
they are different from either abstract classes or Java interfaces.
  I know the latter two, but I have no idea what these "generic interfaces"
could be.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 27 Feb 2004 15:24:46
Message: <403fa78e@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> They're interfaces that can't have code and aren't specific to Java. 

  That's like saying that a "generic int" is a variable which can have
an integer value and is not related to C.
  That statement doesn't make any sense.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Warp
Subject: Re: Object Oriented POV code
Date: 27 Feb 2004 16:38:22
Message: <403fb8ce@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> For example, one could ask "Should a generic int be limited in size in a 
> new programming language? If so, should a generic int throw an error on 
> overflow or just silently wrap around?" You're not asking specifically 
> in the context of C, for which the decision has already been made. 
> You're asking in the context of a new language which hasn't been 
> invented yet.

  The difference is that basically you are saying that these "generic
interfaces" are identical to Java interfaces, but have nothing to do
with Java interfaces...

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

<<< Previous 50 Messages Goto Initial 50 Messages

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