g_nurb.c File Reference

#include "common.h"
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include <math.h>
#include "machine.h"
#include "vmath.h"
#include "db.h"
#include "raytrace.h"
#include "nurb.h"
#include "nmg.h"
#include "rtgeom.h"
#include "./debug.h"

Include dependency graph for g_nurb.c:

Go to the source code of this file.

Data Structures

struct  nurb_specific
struct  nurb_hit

Defines

#define M_SQRT1_2   0.70710678118654752440
#define NULL_HIT   (struct nurb_hit *)0
#define UV_TOL   1.0e-6
#define SEG_MISS(SEG)   (SEG).seg_stp=(struct soltab *) 0;

Functions

int rt_nurb_grans (struct face_g_snurb *srf)
nurb_hitrt_conv_uv (struct nurb_specific *n, struct xray *r, struct rt_nurb_uv_hit *h)
nurb_hitrt_return_nurb_hit (struct nurb_hit *head)
void rt_nurb_add_hit (struct nurb_hit *head, struct nurb_hit *hit, const struct bn_tol *tol)
int rt_nurb_prep (struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
void rt_nurb_print (register const struct soltab *stp)
int rt_nurb_shot (struct soltab *stp, register struct xray *rp, struct application *ap, struct seg *seghead)
void rt_nurb_vshot (struct soltab **stp, struct xray **rp, struct seg *segp, int n, struct application *ap)
void rt_nurb_norm (register struct hit *hitp, struct soltab *stp, register struct xray *rp)
void rt_nurb_curve (register struct curvature *cvp, register struct hit *hitp, struct soltab *stp)
void rt_nurb_uv (struct application *ap, struct soltab *stp, register struct hit *hitp, register struct uvcoord *uvp)
void rt_nurb_free (register struct soltab *stp)
int rt_nurb_class (void)
int rt_nurb_plot (struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
int rt_nurb_tess (struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
int rt_nurb_import (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip)
int rt_nurb_export (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
int rt_nurb_bytes (struct face_g_snurb *srf)
int rt_nurb_export5 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
int rt_nurb_import5 (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip)
void rt_nurb_ifree (struct rt_db_internal *ip)
int rt_nurb_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local)
int rt_nurb_tclget (Tcl_Interp *interp, const struct rt_db_internal *intern, const char *attr)
int rt_nurb_tcladjust (Tcl_Interp *interp, struct rt_db_internal *intern, int argc, char **argv)


Detailed Description

Intersect a ray with a Non Uniform Rational B-Spline.

Authors - Paul R. Stay

Source - SECAD/VLD Computing Consortium, Bldg 394 The U. S. Army Ballistic Research Laboratory Aberdeen Proving Ground, Maryland 21005-5066

Definition in file g_nurb.c.


Define Documentation

#define M_SQRT1_2   0.70710678118654752440
 

Definition at line 64 of file g_nurb.c.

#define NULL_HIT   (struct nurb_hit *)0
 

Definition at line 83 of file g_nurb.c.

Referenced by rt_nurb_shot(), and rt_return_nurb_hit().

#define UV_TOL   1.0e-6
 

Referenced by rt_nurb_shot().

#define SEG_MISS SEG   )     (SEG).seg_stp=(struct soltab *) 0;
 

Definition at line 333 of file g_nurb.c.


Function Documentation

int rt_nurb_grans struct face_g_snurb srf  ) 
 

Definition at line 1103 of file g_nurb.c.

References knot_vector::k_size, face_g_snurb::pt_type, RT_NURB_EXTRACT_COORDS, face_g_snurb::s_size, face_g_snurb::u, and face_g_snurb::v.

Referenced by rt_nurb_export().

struct nurb_hit * rt_conv_uv struct nurb_specific n,
struct xray r,
struct rt_nurb_uv_hit h
 

Definition at line 705 of file g_nurb.c.

References bu_malloc(), nurb_hit::hit_dist, nurb_hit::hit_normal, nurb_hit::hit_point, nurb_hit::hit_private, nurb_hit::hit_uv, nurb_hit::next, nurb_hit::prev, face_g_snurb::pt_type, xray::r_dir, xray::r_pt, RT_NURB_IS_PT_RATIONAL, rt_nurb_s_eval(), nurb_specific::srf, rt_nurb_uv_hit::u, rt_nurb_uv_hit::v, VDOT, VSET, and VSUB2.

Referenced by rt_nurb_shot().

Here is the call graph for this function:

struct nurb_hit * rt_return_nurb_hit struct nurb_hit head  ) 
 

Definition at line 791 of file g_nurb.c.

References head, nurb_hit::hit_dist, INFINITY, nurb_hit::next, NULL_HIT, and nurb_hit::prev.

Referenced by rt_nurb_shot().

void rt_nurb_add_hit struct nurb_hit head,
struct nurb_hit hit,
const struct bn_tol tol
 

Definition at line 741 of file g_nurb.c.

References BN_CK_TOL, bu_free(), bn_tol::dist, head, nurb_hit::hit_dist, nurb_hit::hit_uv, NEAR_ZERO, nurb_hit::next, and nurb_hit::prev.

Referenced by rt_nurb_shot().

Here is the call graph for this function:

int rt_nurb_prep struct soltab stp,
struct rt_db_internal ip,
struct rt_i rtip
 

R T _ N U R B _ P R E P

Given a pointer of a GED database record, and a transformation matrix, determine if this is a valid NURB, and if so, prepare the surface so the intersections will work.

Definition at line 102 of file g_nurb.c.

References nurb_specific::bez_hd, BU_GETSTRUCT, BU_LIST_FOR, BU_LIST_INIT, rt_db_internal::idb_ptr, nurb_specific::next, NMG_CK_SNURB, NULL, rt_nurb_bezier(), rt_nurb_s_bound(), rt_nurb_scopy(), nurb_specific::srf, soltab::st_max, soltab::st_min, VMINMAX, and void().

Here is the call graph for this function:

void rt_nurb_print register const struct soltab stp  ) 
 

R T _ N U R B _ P R I N T

Definition at line 165 of file g_nurb.c.

References bu_log(), nurb_specific::next, rt_nurb_s_print(), and nurb_specific::srf.

Here is the call graph for this function:

int rt_nurb_shot struct soltab stp,
register struct xray rp,
struct application ap,
struct seg seghead
 

R T _ N U R B _ S H O T

Intersect a ray with a nurb. If an intersection occurs, a struct seg will be acquired and filled in.

Returns - 0 MISS >0 HIT

Definition at line 196 of file g_nurb.c.

References application::a_resource, application::a_rt_i, application::a_x, application::a_y, nurb_specific::bez_hd, bn_mk_plane_3pts(), bn_vec_ortho(), bu_free(), BU_LIST_FOR, BU_LIST_INSERT, bu_log(), DEBUG_SPLINE, nurb_hit::hit_dist, nurb_hit::hit_point, nurb_hit::hit_private, nurb_hit::hit_uv, INFINITY, seg::l, face_g_snurb::max_pt, face_g_snurb::min_pt, NEAR_ZERO, nurb_specific::next, rt_nurb_uv_hit::next, NULL_HIT, rt_conv_uv(), RT_G_DEBUG, RT_GET_SEG, rt_in_rpp(), rt_nurb_add_hit(), rt_nurb_intersect(), rt_return_nurb_hit(), rt_i::rti_tol, SQRT_SMALL_FASTF, soltab::st_specific, rt_nurb_uv_hit::sub, rt_nurb_uv_hit::u, UV_TOL, rt_nurb_uv_hit::v, VADD2, VCROSS, VJOIN1, VMOVE, and VSET.

Here is the call graph for this function:

void rt_nurb_vshot struct soltab **  stp,
struct xray **  rp,
struct seg segp,
int  n,
struct application ap
 

R T _ N U R B _ V S H O T

Vectorized version.

Definition at line 341 of file g_nurb.c.

References rt_vstub().

Here is the call graph for this function:

void rt_nurb_norm register struct hit hitp,
struct soltab stp,
register struct xray rp
 

R T _ N U R B _ N O R M

Given ONE ray distance, return the normal and entry/exit point.

Definition at line 357 of file g_nurb.c.

References rt_nurb_s_norm(), face_g_snurb::u, face_g_snurb::v, VMOVE, and VREVERSE.

Here is the call graph for this function:

void rt_nurb_curve register struct curvature cvp,
register struct hit hitp,
struct soltab stp
 

R T _ N U R B _ C U R V E

Return the curvature of the nurb.

Definition at line 385 of file g_nurb.c.

References bn_vec_ortho(), face_g_snurb::order, rt_nurb_curvature(), face_g_snurb::u, and face_g_snurb::v.

Here is the call graph for this function:

void rt_nurb_uv struct application ap,
struct soltab stp,
register struct hit hitp,
register struct uvcoord uvp
 

R T _ N U R B _ U V

For a hit on the surface of an nurb, return the (u,v) coordinates of the hit point, 0 <= u,v <= 1. u = azimuth v = elevation

Definition at line 416 of file g_nurb.c.

void rt_nurb_free register struct soltab stp  ) 
 

R T _ N U R B _ F R E E

Definition at line 429 of file g_nurb.c.

References nurb_specific::bez_hd, BU_LIST_DEQUEUE, BU_LIST_WHILE, nurb_specific::next, NMG_CK_SNURB, NULL, rt_bomb(), and rt_nurb_free_snurb().

Here is the call graph for this function:

int rt_nurb_class void   ) 
 

R T _ N U R B _ C L A S S

Definition at line 458 of file g_nurb.c.

int rt_nurb_plot struct bu_list vhead,
struct rt_db_internal ip,
const struct rt_tess_tol ttol,
const struct bn_tol tol
 

R T _ N U R B _ P L O T

Definition at line 467 of file g_nurb.c.

References rt_tess_tol::abs, rt_db_internal::idb_ptr, int, knot_vector::k_size, knot_vector::knots, M_SQRT1_2, MAGNITUDE, face_g_snurb::max_pt, face_g_snurb::min_pt, NULL, face_g_snurb::order, face_g_snurb::pt_type, rt_tess_tol::rel, RT_CK_DB_INTERNAL, RT_NURB_EXTRACT_COORDS, RT_NURB_IS_PT_RATIONAL, rt_nurb_kvknot(), rt_nurb_par_edge(), rt_nurb_s_refine(), RT_NURB_SPLIT_COL, RT_NURB_SPLIT_ROW, face_g_snurb::u, face_g_snurb::v, and VSUB2.

Here is the call graph for this function:

int rt_nurb_tess struct nmgregion **  r,
struct model m,
struct rt_db_internal ip,
const struct rt_tess_tol ttol,
const struct bn_tol tol
 

R T _ N U R B _ T E S S

Definition at line 597 of file g_nurb.c.

int rt_nurb_import struct rt_db_internal ip,
const struct bu_external ep,
register const fastf_t mat,
const struct db_i dbip
 

R T _ N U R B _ I M P O R T

Definition at line 606 of file g_nurb.c.

References record::B, record::B_solid::B_nsurf, BU_CK_EXTERNAL, bu_log(), bu_malloc(), record::d, record::b_surf::d_id, DB5_MAJORTYPE_BRLCAD, bu_external::ext_buf, record::i, ID_BSOLID, ID_BSPLINE, ID_BSURF, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, RT_CK_DB_INTERNAL, record::s, and record::u_id.

Here is the call graph for this function:

int rt_nurb_export struct bu_external ep,
const struct rt_db_internal ip,
double  local2mm,
const struct db_i dbip
 

R T _ N U R B _ E X P O R T

Definition at line 825 of file g_nurb.c.

References ID_BSPLINE, rt_db_internal::idb_ptr, record::n, RT_CK_DB_INTERNAL, rt_nurb_grans(), and record::s.

Here is the call graph for this function:

int rt_nurb_bytes struct face_g_snurb srf  ) 
 

Definition at line 912 of file g_nurb.c.

References knot_vector::k_size, face_g_snurb::pt_type, RT_NURB_EXTRACT_COORDS, face_g_snurb::s_size, SIZEOF_NETWORK_DOUBLE, SIZEOF_NETWORK_LONG, face_g_snurb::u, and face_g_snurb::v.

Referenced by rt_nurb_export5().

int rt_nurb_export5 struct bu_external ep,
const struct rt_db_internal ip,
double  local2mm,
const struct db_i dbip
 

R T _ N U R B _ E X P O R T 5

Definition at line 931 of file g_nurb.c.

References BU_INIT_EXTERNAL, bu_external::ext_nbytes, ID_BSPLINE, rt_db_internal::idb_ptr, RT_CK_DB_INTERNAL, rt_nurb_bytes(), and SIZEOF_NETWORK_LONG.

Here is the call graph for this function:

int rt_nurb_import5 struct rt_db_internal ip,
const struct bu_external ep,
register const fastf_t mat,
const struct db_i dbip
 

R T _ N U R B _ I M P O R T 5

Definition at line 1000 of file g_nurb.c.

References bu_calloc(), BU_CK_EXTERNAL, bu_glong(), bu_malloc(), DB5_MAJORTYPE_BRLCAD, bu_external::ext_buf, ID_BSPLINE, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, MAT4X3PNT, ntohd(), NULL, face_g_snurb::order, face_g_snurb::pt_type, RT_CK_DB_INTERNAL, RT_NURB_EXTRACT_COORDS, rt_nurb_kvnorm(), RT_NURB_MAKE_PT_TYPE, rt_nurb_new_snurb(), RT_NURB_PT_NONRAT, RT_NURB_PT_RATIONAL, RT_NURB_PT_XYZ, face_g_snurb::s_size, SIZEOF_NETWORK_DOUBLE, SIZEOF_NETWORK_LONG, and VMOVE.

Here is the call graph for this function:

void rt_nurb_ifree struct rt_db_internal ip  ) 
 

R T _ N U R B _ I F R E E

Definition at line 1125 of file g_nurb.c.

References rt_db_internal::idb_ptr, NULL, RT_CK_DB_INTERNAL, and rt_nurb_free_snurb().

Here is the call graph for this function:

int rt_nurb_describe struct bu_vls str,
const struct rt_db_internal ip,
int  verbose,
double  mm2local
 

R T _ N U R B _ D E S C R I B E

Definition at line 1150 of file g_nurb.c.

References bu_vls_printf(), bu_vls_strcat(), rt_db_internal::idb_ptr, INTCLAMP, NMG_CK_SNURB, RT_NURB_EXTRACT_COORDS, X, Y, and Z.

Here is the call graph for this function:

int rt_nurb_tclget Tcl_Interp interp,
const struct rt_db_internal intern,
const char *  attr
 

Definition at line 1223 of file g_nurb.c.

References bu_vls_init(), bu_vls_printf(), bu_vls_strcpy(), rt_db_internal::idb_ptr, NULL, and status.

Here is the call graph for this function:

int rt_nurb_tcladjust Tcl_Interp interp,
struct rt_db_internal intern,
int  argc,
char **  argv
 

Definition at line 1281 of file g_nurb.c.

References bu_calloc(), bu_free(), face_g_snurb::ctl_points, rt_db_internal::idb_ptr, interp, knot_vector::k_size, knot_vector::knots, NULL, face_g_snurb::order, face_g_snurb::pt_type, RT_CK_DB_INTERNAL, RT_NURB_EXTRACT_COORDS, rt_nurb_free_snurb(), rt_nurb_new_snurb(), face_g_snurb::s_size, TCL_ERROR, tcl_obj_to_fastf_array(), tcl_obj_to_int_array(), TCL_OK, TCL_STATIC, face_g_snurb::u, and face_g_snurb::v.

Here is the call graph for this function:


Generated on Mon Sep 18 01:25:05 2006 for BRL-CAD by  doxygen 1.4.6