 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Wed, 14 Mar 2001 15:09:17 +0200, Peter Popov <pet### [at] vip bg> 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] hamiltonite com
http://hamiltonite.com/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <7p5uatkfp1lg0lluhftkg2ad9okphd814a@4ax.com> , Peter Popov
<pet### [at] vip bg> 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] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <7p5uatkfp1lg0lluhftkg2ad9okphd814a@4ax.com> , Peter Popov
<pet### [at] vip bg> 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] trf de
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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] hamiltonite com
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Wed, 14 Mar 2001 15:14:09 +0100, "Mael" <Mae### [at] hotmail com>
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] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Wed, 14 Mar 2001 09:41:48 -0600, "Thorsten Froehlich"
<tho### [at] trf de> 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] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Roberto Ferrer de Amorim
Subject: Re: Pass a POV object to a class
Date: 15 Mar 2001 07:48:33
Message: <3ab0ba21@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Check http://www.mindview.net/ . There is an online (downloadable) book
there called "Thinking in C++". It has a great section about the STL.
Wolfox
Peter Popov <pet### [at] vip bg> wrote in message
news:3lm0bt0llofncm7ert3i1vgv3d2ua1rlsv@4ax.com...
> On Wed, 14 Mar 2001 09:41:48 -0600, "Thorsten Froehlich"
> <tho### [at] trf de> 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] vip bg
> TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 15 Mar 2001 08:00:50 +0200, Peter Popov wrote:
>On Wed, 14 Mar 2001 15:14:09 +0100, "Mael" <Mae### [at] hotmail com>
>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.
It is a struct, but one of its members is an array of pointers to functions.
A C++ programmer might call it a vtable.
The first C++ compilers compiled to C, you know.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 15 Mar 2001 09:47:39 -0300, "Roberto Ferrer de Amorim"
<ram### [at] comdesconto com br> wrote:
>Check http://www.mindview.net/ . There is an online (downloadable) book
>there called "Thinking in C++". It has a great section about the STL.
I will gladly RTFM right away! I have that book in three different
formats and even started reading it. Sheesh!
<head up mine>
Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vip bg
TAG e-mail : pet### [at] tag povray org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <7p5uatkfp1lg0lluhftkg2ad9okphd814a@4ax.com>, Peter Popov
<pet### [at] vip bg> wrote:
> I remember Chris Huff wrote a patch-HOWTO some time ago, some
> up-to-date advice along the same lines would be very appreciated.
Unfortunately, my patch tutorial didn't cover integrating C++ code with
C, something that I've never done and hope never to do. I vaguely recall
saving some messages about doing this, though...I could look around and
see if I still have them, if you want. I'm pretty sure they came from
this server and this group...
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |