POV-Ray : Newsgroups : povray.programming : Vectors in C++ : Re: Vectors in C++ Server Time
6 Oct 2024 14:01:36 EDT (-0400)
  Re: Vectors in C++  
From: Micha Riser
Date: 15 Dec 2002 17:43:53
Message: <3dfd05a9@news.povray.org>
Reusser wrote:

> Hey,
>    I know this will probably sound like a dumb question to all of the
> programmers in here, but I'm completely new to C++ and I'm pretty
> confused.  I found a vector class online but I don't know quite how to
> use it.  Every time I try, I get more errors than there are lines of
> text.  How would I define a simple 3d vector like I would in POV so I
> can do basic operations on it?  Thanks in advance.

The vector class (or rather the vector *template*) that comes with the 
standard library is useful for holding a dynamical number of entries. For a 
simple 3d vector use an array as in C - or if you want to do it 
object-orientated write a Vector class around it. 

As example the class I have written for my raytracer for that purpose:
http://www.povworld.org/raytracer/api/raytracer___vector_h.html

-- 
objects.povworld.org - The POV-Ray Objects Collection
book.povworld.org    - The POV-Ray Book Project


Post a reply to this message

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