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

Go to the source code of this file.

Functions

objectnewstri (void *, vector, vector, vector, vector, vector, vector)
objectnewtri (void *, vector, vector, vector)

Function Documentation

object* newstri ( void *  ,
vector  ,
vector  ,
vector  ,
vector  ,
vector  ,
vector   
)

Definition at line 118 of file triangle.cpp.

References EPSILON, rt_getmem(), stri_methods, VLength(), and VSub().

Referenced by rt_stri().

                                                            {
  stri * t;
  vector edge1, edge2, edge3;

  VSub(&v1, &v0, &edge1);
  VSub(&v2, &v0, &edge2);
  VSub(&v2, &v1, &edge3);

  /* check to see if this will be a degenerate triangle before creation */
  if ((VLength(&edge1) >= EPSILON) && 
      (VLength(&edge2) >= EPSILON) &&
      (VLength(&edge3) >= EPSILON)) {

    t=(stri *) rt_getmem(sizeof(stri));

    t->nextobj = NULL;
    t->methods = &stri_methods;
 
    t->tex = (texture *)tex;
    t->v0 = v0;
    t->edge1 = edge1;
    t->edge2 = edge2;
    t->n0 = n0;
    t->n1 = n1;
    t->n2 = n2;

    return (object *) t;
  }

  return NULL; /* was a degenerate triangle */
}
object* newtri ( void *  ,
vector  ,
vector  ,
vector   
)

Definition at line 88 of file triangle.cpp.

References EPSILON, rt_getmem(), tri_methods, VLength(), and VSub().

Referenced by rt_tri().

                                                             {
  tri * t;
  vector edge1, edge2, edge3;

  VSub(&v1, &v0, &edge1);
  VSub(&v2, &v0, &edge2);
  VSub(&v2, &v1, &edge3);

  /* check to see if this will be a degenerate triangle before creation */
  if ((VLength(&edge1) >= EPSILON) && 
      (VLength(&edge2) >= EPSILON) && 
      (VLength(&edge3) >= EPSILON)) {

    t=(tri *) rt_getmem(sizeof(tri));

    t->nextobj = NULL;
    t->methods = &tri_methods;

    t->tex = (texture *)tex;
    t->v0 = v0;
    t->edge1 = edge1;
    t->edge2 = edge2;
 
    return (object *) t;
  }
  
  return NULL; /* was a degenerate triangle */
}

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