POV-Ray : Newsgroups : povray.programming : Pass a POV object to a class Server Time
24 Dec 2024 11:41:28 EST (-0500)
  Pass a POV object to a class (Message 1 to 10 of 14)  
Goto Latest 10 Messages Next 4 Messages >>>
From: Peter Popov
Subject: Pass a POV object to a class
Date: 14 Mar 2001 08:08:05
Message: <7p5uatkfp1lg0lluhftkg2ad9okphd814a@4ax.com>
I am writing a patch and I am writing it in C++. I chose C++ because
it's easier to use once the base classes are implemented (and also
because I could overload vector operators so I could copy & paste
working code directly from my POV test scenes :) ). I've only spent
about five days with c++ but I've already fallen in love with it.

Anyway, the base classes are now ready and have been tested thoroughly
(or so I hope). I can do some more work before I start integrating it
in POV, but eventually I will have to do it. The question is, how do I
proceed? I remember Chris Huff wrote a patch-HOWTO some time ago, some
up-to-date advice along the same lines would be very appreciated.

Now, there are some specific problems I have. I need to pass a POV
object (sphere, csg, whatever) struct, or a pointer to one, to a
method in a class I have made, and that method should be able to call
the insideness test of that object. Correct me if I am wrong but I
don't think that in POV this has been implemented in a polymorphic
way. How should I proceed?

Also, I will need a method to create an idat3d array of floats. How
would I go about this?

Lastly, a side question. Are there license-free, public-domain,
cross-platform examples of polymorphic sorted lists, binary, quad- and
oct-trees or should I make them myself? Granted, I will eventually do
so since this is my final year project and I want to have done as much
as possible myself when I defend it, but until then, it can save me
some brain cells.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Mael
Subject: Re: Pass a POV object to a class
Date: 14 Mar 2001 09:13:13
Message: <3aaf7c79@news.povray.org>
> I've only spent
> about five days with c++ but I've already fallen in love with it.

yes, c++ is really cool, i can t wait for pov 4 :)

> Now, there are some specific problems I have. I need to pass a POV
> object (sphere, csg, whatever) struct, or a pointer to one, to a
> method in a class I have made, and that method should be able to call
> the insideness test of that object. Correct me if I am wrong but I
> don't think that in POV this has been implemented in a polymorphic
> way. How should I proceed?

you can use an OBJECT* and call Inside_Object :
Inside_Object (VECTOR IPoint, OBJECT *Object)

M

PS: what will do your patch ?


Post a reply to this message

From: Mael
Subject: Re: Pass a POV object to a class
Date: 14 Mar 2001 09:46:23
Message: <3aaf843f@news.povray.org>
> Lastly, a side question. Are there license-free, public-domain,
> cross-platform examples of polymorphic sorted lists, binary, quad- and
> oct-trees or should I make them myself?

i just find a generic bsp tree, don t know if it can help you..

http://www.flipcode.com/cgi-bin/msg.cgi?showThread=COTD-GenericBSP&forum=cot
d&id=-1

M


Post a reply to this message

From: David Wilkinson
Subject: Re: Pass a POV object to a class
Date: 14 Mar 2001 10:30:01
Message: <lr1vat057106tpcd2cp26m8glphl24i7vf@4ax.com>
On Wed, 14 Mar 2001 15:09:17 +0200, Peter Popov <pet### [at] vipbg> wrote:

>I am writing a patch and I am writing it in C++. I chose C++ because
>it's easier to use once the base classes are implemented (and also
>because I could overload vector operators so I could copy & paste
>working code directly from my POV test scenes :) ). I've only spent
>about five days with c++ but I've already fallen in love with it.
>

I can't help you with your problems Peter, but I too have fallen for C++ having
recently installed Borland C++ Builder 4 for free from the PCAnswers magazine
CD.  This really does simplify developing programs for MS Windows.
The idea of overloading vector operators to use POV code is an interesting idea
that I must investigate.   
----------------------
dav### [at] hamiltonitecom
http://hamiltonite.com/


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Pass a POV object to a class
Date: 14 Mar 2001 10:41:50
Message: <3aaf913e$1@news.povray.org>
In article <7p5uatkfp1lg0lluhftkg2ad9okphd814a@4ax.com> , Peter Popov 
<pet### [at] vipbg>  wrote:

> Lastly, a side question. Are there license-free, public-domain,
> cross-platform examples of polymorphic sorted lists, binary, quad- and
> oct-trees or should I make them myself?

You just use the "polymorphic reference type" - others might call it "a
pointer" :-)

Lets say you have something like this (abbreviated syntax):

  class Base;
  class Building : Base;
  class House : Building;
  class Tower : Building;
  class Garage : Building;

And you want to store all buildings, you just do:

  vector<Building *> buildings;

You can access individual objects in a type safe manner like this:

  House *house = dynamic_cast<House *>(buildings[3]);

If is was a House dynamic_cast returns a valid pointer to a House.  If
not, it return NULL.  Note that dynamic_cast throws exceptions if you
cast references.


     Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Pass a POV object to a class
Date: 14 Mar 2001 10:45:01
Message: <3aaf91fd$1@news.povray.org>
In article <7p5uatkfp1lg0lluhftkg2ad9okphd814a@4ax.com> , Peter Popov 
<pet### [at] vipbg>  wrote:

> sorted lists, binary, quad- and
> oct-trees or should I make them myself?

BTW, the STL does provides these in some form or the other.  However, it
depend on exactly what you want to do.


      Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Roberto Ferrer de Amorim
Subject: Re: Pass a POV object to a class
Date: 14 Mar 2001 12:41:00
Message: <3aafad2c@news.povray.org>
> Lastly, a side question. Are there license-free, public-domain,
> cross-platform examples of polymorphic sorted lists, binary, quad- and
> oct-trees or should I make them myself? Granted, I will eventually do
> so since this is my final year project and I want to have done as much
> as possible myself when I defend it, but until then, it can save me
> some brain cells.

glib is a very good library, but it's in C. AFAIK, it can be polimorphic and
has all sorts of lists and trees, but take a look yourself on it. Here's the
link to download:

ftp://ftp.gtk.org/pub/gtk/v1.2/glib-1.2.9.tar.gz

About 400k. Take a look and see if it fits - however, you can always use the
STL on C++, although I do not recommend you do that. :-)

Wolfox

- I used to program in C++, then I found Java. I used to program in Java,
then I found Python (http://www.python.org/)


Post a reply to this message

From: Sander
Subject: Re: Pass a POV object to a class
Date: 14 Mar 2001 15:17:54
Message: <MPG.1519f05d7ac1416d989709@NEWS.POVRAY.ORG>
In article <lr1vat057106tpcd2cp26m8glphl24i7vf@4ax.com>, David Wilkinson 
says...
> I can't help you with your problems Peter, but I too have fallen for C++ having
> recently installed Borland C++ Builder 4 for free from the PCAnswers magazine
> CD.  This really does simplify developing programs for MS Windows.
> The idea of overloading vector operators to use POV code is an interesting idea
> that I must investigate.   
> ----------------------
> dav### [at] hamiltonitecom
> http://hamiltonite.com/
> 
Welcome to C++Builder, David! I had versions 1,2,3, skipped 4 and now 5. 
Suppose it will last for the time remaining: the upgrades are too 
expensive. I use it for my (as the expression goes in Dutch) "house, 
garden and kitchen programs", since I'm not much of a programmer at 
all... Although I did the Windows frontend for CMPEG with it. :)
-- 
Regards,  Sander


Post a reply to this message

From: Peter Popov
Subject: Re: Pass a POV object to a class
Date: 15 Mar 2001 00:59:38
Message: <igm0btg4p7so8s5adiiuom6bd3972ehqik@4ax.com>
On Wed, 14 Mar 2001 15:14:09 +0100, "Mael" <Mae### [at] hotmailcom>
wrote:

>you can use an OBJECT* and call Inside_Object :
>Inside_Object (VECTOR IPoint, OBJECT *Object)

But isn't OBJECT a struct? I mean, I know it works for classes (that's
how I fit them all in the same list) but I didn't know it worked for
structs.


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Peter Popov
Subject: Re: Pass a POV object to a class
Date: 15 Mar 2001 01:02:50
Message: <3lm0bt0llofncm7ert3i1vgv3d2ua1rlsv@4ax.com>
On Wed, 14 Mar 2001 09:41:48 -0600, "Thorsten Froehlich"
<tho### [at] trfde> wrote:

>You just use the "polymorphic reference type" - others might call it "a
>pointer" :-)

Thorsten, that's what I am doing now :) I just realised that people
have done it before a million times and someone might have chosen to
share his code with newbies, 's all.

I might use the one in STL, the problem is, I don't have any
description of the STL and I don't feel like hacking into libc.a again
:)


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

Goto Latest 10 Messages Next 4 Messages >>>

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