POV-Ray : Newsgroups : povray.off-topic : 99 lines of C++ for an unbiased ray tracer : Re: 99 lines of C++ for an unbiased ray tracer Server Time
4 Sep 2024 23:18:24 EDT (-0400)
  Re: 99 lines of C++ for an unbiased ray tracer  
From: Orchid XP v8
Date: 14 Jan 2010 14:21:46
Message: <4b4f6eca$1@news.povray.org>
>> 44:  double n=sizeof(spheres)/sizeof(Sphere);
>>
>> Well... that's... one way to figure out how big an array is. :-.
> 
> That's the usual way to figure out how big an array is in C and C++.

It is surprising to me that this actually works. I was under the 
impression that C does not actually distinguish between pointers and 
arrays (and integers and booleans and...)

>> Evidently my C++ is weak, but... how is
>> 53:  Vec nl=n.dot(r.d)<0?n:n*-1;
>> different from "nl = -abs(n.dot(r.d))"?
> 
> In the lack of needing to define the abs() function?

No, I misread the code. It's actually deciding whether to negate n based 
on a function of n, not n itself.

>> Also, where THE HELL is "Xi" defined? I can see it *used* in several 
>> places, but I can't find a definitions.
> 
> Line 48. It's an argument to the function.

No, it's an argument in the radiance() function, I meant where is it 
defined in main().

> Note that text search will 
> usually answer that sort of question on a C program, and often on a C++ 
> program too.
> 
> Not always, mind, but usually.

Yeah, I tried that too...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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