POV-Ray : Newsgroups : povray.programming : Bug in Compute_Axis_Rotation_Transform() : Re: Bug in Compute_Axis_Rotation_Transform() Server Time
28 Jul 2024 14:29:56 EDT (-0400)
  Re: Bug in Compute_Axis_Rotation_Transform()  
From: Markus Becker
Date: 3 Jul 2000 06:03:30
Message: <3960661E.A3C7871A@student.uni-siegen.de>
Chris Huff wrote:
> 
> The use of VLength and VInverseScaleEq instead of VNormalize wasn't the
> bug I was talking about...the vector passed to the function is being
> normalized, when the function should create it's own copy. Since a

As far as my understanding of C and the workings of the POV-type
VECTOR go, this should *not* modify the "real" V1, since the value is
passed on the stack. The V1 in the function gets modified, but *not*
the parameter that is passed, example:

int ParamFunction(int i)
{
   i = i/2;	// modify parameter
   return i;	// and return the result
}

void TestParam(void)
{
   int x;

   x = 5;
   printf("%d\n",ParamFunction(x));  // prints "2"
   printf("%d\n",x);                 // prints "5", i.e. "x"
}

This prints:
   2    5

i.e. internal to the function, the parameter "i" gets modified,
but this does *not* modify the "calling" parameter x.

This is guaranteed by the C standard.

Or is the "VECTOR" type some hidden pointer?

Markus


Post a reply to this message

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