Shadowrun: Awakened 29 September 2011 - Build 871
Defines | Functions
coordsys.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define TWOPI   6.2831853

Functions

void xytopolar (flt, flt, flt, flt *, flt *)
void xyztocyl (vector, flt, flt *, flt *)
void xyztospr (vector, flt *, flt *)

Define Documentation

#define TWOPI   6.2831853

Definition at line 64 of file coordsys.h.

Referenced by xytopolar(), xyztocyl(), and xyztospr().


Function Documentation

void xytopolar ( flt  ,
flt  ,
flt  ,
flt ,
flt  
)

Definition at line 68 of file coordsys.cpp.

References TWOPI.

                                                        {
  flt r1;
  r1=x*x + y*y;  
  *v=sqrt(r1 / (rad*rad));
  if (y<0.0) 
    *u=1.0 - acos(x/sqrt(r1))/TWOPI;
  else 
    *u= acos(x/sqrt(r1))/TWOPI; 
}
void xyztocyl ( vector  ,
flt  ,
flt ,
flt  
)

Definition at line 78 of file coordsys.cpp.

References TWOPI, vector::x, vector::y, and vector::z.

Referenced by cyl_checker_texture(), and image_cyl_texture().

                                                        {
  flt r1;

  r1=pnt.x*pnt.x + pnt.y*pnt.y;

  *v=pnt.z / height;
  if (pnt.y<0.0) 
    *u=1.0 - acos(pnt.x/sqrt(r1))/TWOPI;
  else 
    *u=acos(pnt.x/sqrt(r1))/TWOPI;
}
void xyztospr ( vector  ,
flt ,
flt  
)

Definition at line 90 of file coordsys.cpp.

References TWOPI, vector::x, vector::y, and vector::z.

Referenced by image_sphere_texture().

                                            {
  flt r1, phi, theta;
 
  r1=sqrt(pnt.x*pnt.x + pnt.y*pnt.y + pnt.z*pnt.z);

  phi=acos(-pnt.y/r1);   
  *v=phi/3.1415926;

  theta=acos((pnt.x/r1)/sin(phi))/TWOPI;

  if (pnt.z > 0.0) 
    *u = theta;
  else 
    *u = 1 - theta; 
}

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net