BRL-CAD
test_bottess.c File Reference
#include "common.h"
#include "vmath.h"
#include "bn.h"
#include "raytrace.h"
#include "nmg.h"
#include "gcv.h"
#include "./soup.h"
#include "./tri_intersect.h"
Include dependency graph for test_bottess.c:

Go to the source code of this file.

Macros

#define TRY(suc, t00x, t00y, t00z, t01x, t01y, t01z, t02x, t02y, t02z, t10x, t10y, t10z, t11x, t11y, t11z, t12x, t12y, t12z, p0x, p0y, p0z, p1x, p1y, p1z)
 
#define PREP(t00, t01, t02, t10, t11, t12, t20, t21, t22, ispt00, ispt01, ispt02, ispt10, ispt11, ispt12, _nsplt)
 
#define POST(name)
 
#define ZORF(XVAL, ZVAL, LR, FU)   VSET(f.vert[0], 0,0,0); VSET(f.vert[1], 0,1,0); VSET(f.vert[2], XVAL,0,ZVAL); tri = find_tri(&LR, &f, &t); if (tri==-1 || l.faces[tri].foo != FU) { count++; printf("\033[1;31mFAILURE\033[m\n"); }
 
#define PREP   l.magic = RT_TREE_MAGIC; ls.magic = SOUP_MAGIC; lm.magic = NMG_MODEL_MAGIC; lnr.m_p = &lm; ls.faces = NULL; ls.nfaces = ls.maxfaces = 0; l.tr_d.td_r = &lnr; l.tr_d.td_r->m_p = (struct model *)&ls; BU_ALLOC(r, union tree); BU_ALLOC(rs, struct soup_s); r->magic = RT_TREE_MAGIC; rs->magic = SOUP_MAGIC; rm.magic = NMG_MODEL_MAGIC; rnr.m_p = &rm; rs->faces = NULL; rs->nfaces = rs->maxfaces = 0; r->tr_d.td_r = &rnr; r->tr_d.td_r->m_p = (struct model *)rs;
 
#define TRY(STR, FNC)   { int rval = FNC(); printf("RESULT:%18s: \033[1;", STR); if (rval) printf("31m%d\033[m failures\n", rval); else printf("32mOK\033[m\n"); }
 

Functions

int test_intersection (int should, point_t *t1, point_t *t2, point_t p1, point_t p2)
 
int test_tri_intersections ()
 
int test_face_split_single ()
 
int test_face_splits ()
 
int test_invert ()
 
int test_compose ()
 
int test_evaluate ()
 
int main (void)
 

Macro Definition Documentation

#define TRY (   suc,
  t00x,
  t00y,
  t00z,
  t01x,
  t01y,
  t01z,
  t02x,
  t02y,
  t02z,
  t10x,
  t10y,
  t10z,
  t11x,
  t11y,
  t11z,
  t12x,
  t12y,
  t12z,
  p0x,
  p0y,
  p0z,
  p1x,
  p1y,
  p1z 
)
Value:
{ \
point_t t0[3], t1[3], p0, p1; \
VSET(t0[0],t00x,t00y,t00z); VSET(t0[1],t01x,t01y,t01z); VSET(t0[2],t02x,t02y,t02z); \
VSET(t1[0],t10x,t10y,t10z); VSET(t1[1],t11x,t11y,t11z); VSET(t1[2],t12x,t12y,t12z); \
VSET(p0,p0x,p0y,p0z); VSET(p1,p1x,p1y,p1z); \
count += test_intersection(suc, t0, t1, p0, p1); }
#define VSET(a, b, c, d)
Definition: color.c:53
int test_intersection(int should, point_t *t1, point_t *t2, point_t p1, point_t p2)
Definition: test_bottess.c:37

Referenced by main(), and test_tri_intersections().

#define PREP (   t00,
  t01,
  t02,
  t10,
  t11,
  t12,
  t20,
  t21,
  t22,
  ispt00,
  ispt01,
  ispt02,
  ispt10,
  ispt11,
  ispt12,
  _nsplt 
)
Value:
{ \
point_t isectpt[2]; \
int urf[_nsplt+1]; \
unsigned long int failure = 0, numsplit = _nsplt; \
for (i = 0; i < _nsplt + 1; ++i) urf[i] = 0; \
tcount++; \
VSET(isectpt[0],ispt00,ispt01,ispt02); \
VSET(isectpt[1],ispt10,ispt11,ispt12); \
s.magic = SOUP_MAGIC; \
s.faces = NULL; \
s.maxfaces = 0; \
s.nfaces = 0; \
VSET(f.vert[0],t00,t01,t02); \
VSET(f.vert[1],t10,t11,t12); \
VSET(f.vert[2],t20,t21,t22); \
soup_add_face(&s,V3ARGS(f.vert),&t); \
VSET(f.plane,0,0,1); \
nsplt = split_face_single(&s,0,isectpt,&f,&t); \
if (nsplt != s.nfaces) { \
printf("Error, nsplit %lu != s.nfaces %lu ?\n", numsplit, s.nfaces); \
}
if lu s
Definition: nmg_mod.c:3860
#define VSET(a, b, c, d)
Definition: color.c:53
#define SOUP_MAGIC
Definition: soup.h:40
if(share_geom)
Definition: nmg_mod.c:3829
#define V3ARGS(a)
Definition: color.c:56
int split_face_single(struct soup_s *s, unsigned long int fid, point_t isectpt[2], struct face_s *opp_face, const struct bn_tol *tol)
Definition: bottess.c:115
int soup_add_face(struct soup_s *s, point_t a, point_t b, point_t c, const struct bn_tol *tol)
Definition: bottess.c:101

Referenced by test_compose(), and test_face_split_single().

#define POST (   name)
Value:
for (i = 0; i < numsplit; i++) { \
VSET(f.vert[0],_splits[i][0],_splits[i][1],_splits[i][2]); \
VSET(f.vert[1],_splits[i][3],_splits[i][4],_splits[i][5]); \
VSET(f.vert[2],_splits[i][6],_splits[i][7],_splits[i][8]); \
urf[i] = find_tri(&s,&f,&t); \
if (urf[i] == -1) failure++; \
} \
if (nsplt != 2 && urf[0] == -1 && urf[1] == -1) { \
printf("\033[1;31mFAILURE "name"\033[m\n"); \
printf("%lu faces now\n",s.nfaces); \
for (i = 0; i < s.nfaces; i++) \
printf("%03lu: % 2g,% 2g,% 2g | % 2g,% 2g,% 2g | % 2g,% 2g,% 2g\n", \
i, V3ARGS(s.faces[i].vert[0]), V3ARGS(s.faces[i].vert[1]), V3ARGS(s.faces[i].vert[2])); \
count++; \
} \
free(s.faces); \
} /* NOTE THIS IS THE CLOSING BRACE FROM THE OPENING BRACE IN THE PREVIOUS MACRO!! */
if lu s
Definition: nmg_mod.c:3860
Definition: clone.c:90
#define VSET(a, b, c, d)
Definition: color.c:53
if(share_geom)
Definition: nmg_mod.c:3829
#define V3ARGS(a)
Definition: color.c:56

Referenced by test_face_split_single().

#define ZORF (   XVAL,
  ZVAL,
  LR,
  FU 
)    VSET(f.vert[0], 0,0,0); VSET(f.vert[1], 0,1,0); VSET(f.vert[2], XVAL,0,ZVAL); tri = find_tri(&LR, &f, &t); if (tri==-1 || l.faces[tri].foo != FU) { count++; printf("\033[1;31mFAILURE\033[m\n"); }

Referenced by test_face_splits().

#define PREP   l.magic = RT_TREE_MAGIC; ls.magic = SOUP_MAGIC; lm.magic = NMG_MODEL_MAGIC; lnr.m_p = &lm; ls.faces = NULL; ls.nfaces = ls.maxfaces = 0; l.tr_d.td_r = &lnr; l.tr_d.td_r->m_p = (struct model *)&ls; BU_ALLOC(r, union tree); BU_ALLOC(rs, struct soup_s); r->magic = RT_TREE_MAGIC; rs->magic = SOUP_MAGIC; rm.magic = NMG_MODEL_MAGIC; rnr.m_p = &rm; rs->faces = NULL; rs->nfaces = rs->maxfaces = 0; r->tr_d.td_r = &rnr; r->tr_d.td_r->m_p = (struct model *)rs;
#define TRY (   STR,
  FNC 
)    { int rval = FNC(); printf("RESULT:%18s: \033[1;", STR); if (rval) printf("31m%d\033[m failures\n", rval); else printf("32mOK\033[m\n"); }

Function Documentation

int test_intersection ( int  should,
point_t *  t1,
point_t *  t2,
point_t  p1,
point_t  p2 
)

Definition at line 37 of file test_bottess.c.

References BN_TOL_INIT, bn_tol::dist, bn_tol::dist_sq, face_s::foo, and gcv_tri_tri_intersect_with_isectline().

Here is the call graph for this function:

int test_tri_intersections ( )

Definition at line 71 of file test_bottess.c.

References TRY.

Referenced by main().

int test_face_split_single ( )

Definition at line 102 of file test_bottess.c.

References BN_TOL_INIT, bn_tol::dist, bn_tol::dist_sq, POST, and PREP.

Referenced by main().

int test_face_splits ( )

Definition at line 194 of file test_bottess.c.

References BN_TOL_INIT, bn_tol::dist, bn_tol::dist_sq, soup_s::faces, INSIDE, soup_s::magic, soup_s::maxfaces, soup_s::nfaces, OUTSIDE, soup_add_face(), SOUP_MAGIC, split_face(), VSET, and ZORF.

Referenced by main().

Here is the call graph for this function:

int test_invert ( )

Definition at line 235 of file test_bottess.c.

Referenced by main().

int test_compose ( )

Definition at line 240 of file test_bottess.c.

References BN_TOL_INIT, compose(), bn_tol::dist, bn_tol::dist_sq, soup_s::faces, face_s::foo, INSIDE, soup_s::nfaces, OUTSIDE, PREP, soup_add_face(), V3ARGS, and VSET.

Referenced by main().

Here is the call graph for this function:

int test_evaluate ( )

Definition at line 305 of file test_bottess.c.

Referenced by main().

int main ( void  )

Definition at line 311 of file test_bottess.c.

References test_compose(), test_evaluate(), test_face_split_single(), test_face_splits(), test_invert(), test_tri_intersections(), and TRY.

Here is the call graph for this function: