g_sketch.c File Reference

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

Include dependency graph for g_sketch.c:

Go to the source code of this file.

Defines

#define RT_SKETCH_SEG_MISS(SEG)   (SEG).seg_stp=RT_SOLTAB_NULL

Functions

fastf_t rt_cnurb_par_edge (const struct edge_g_cnurb *crv, fastf_t epsilon)
void get_indices (genptr_t seg, int *start, int *end)
int rt_check_curve (struct curve *crv, struct rt_sketch_internal *skt, int noisey)
int rt_sketch_prep (struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
void rt_sketch_print (register const struct soltab *stp)
int rt_sketch_shot (struct soltab *stp, register struct xray *rp, struct application *ap, struct seg *seghead)
void rt_sketch_vshot (struct soltab **stp, struct xray **rp, struct seg *segp, int n, struct application *ap)
void rt_sketch_norm (register struct hit *hitp, struct soltab *stp, register struct xray *rp)
void rt_sketch_curve (register struct curvature *cvp, register struct hit *hitp, struct soltab *stp)
void rt_sketch_uv (struct application *ap, struct soltab *stp, register struct hit *hitp, register struct uvcoord *uvp)
void rt_sketch_free (register struct soltab *stp)
int rt_sketch_class (void)
int seg_to_vlist (struct bu_list *vhead, const struct rt_tess_tol *ttol, fastf_t *V, fastf_t *u_vec, fastf_t *v_vec, struct rt_sketch_internal *sketch_ip, genptr_t seg)
int curve_to_vlist (struct bu_list *vhead, const struct rt_tess_tol *ttol, fastf_t *V, fastf_t *u_vec, fastf_t *v_vec, struct rt_sketch_internal *sketch_ip, struct curve *crv)
int rt_sketch_plot (struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
int rt_sketch_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_sketch_import (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip)
int rt_sketch_export (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
int rt_sketch_import5 (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip)
int rt_sketch_export5 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
int rt_sketch_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local)
void rt_curve_free (struct curve *crv)
void rt_sketch_ifree (struct rt_db_internal *ip)
void rt_copy_curve (struct curve *crv_out, const struct curve *crv_in)
rt_sketch_internalrt_copy_sketch (const struct rt_sketch_internal *sketch_ip)
int curve_to_tcl_list (struct bu_vls *vls, struct curve *crv)
int rt_sketch_tclform (const struct rt_functab *ftp, Tcl_Interp *interp)
int rt_sketch_tclget (Tcl_Interp *interp, const struct rt_db_internal *intern, const char *attr)
int get_tcl_curve (Tcl_Interp *interp, struct curve *crv, Tcl_Obj *seg_list)
int rt_sketch_tcladjust (Tcl_Interp *interp, struct rt_db_internal *intern, int argc, char **argv)
void rt_curve_reverse_segment (long *lng)
void rt_curve_order_segments (struct curve *crv)


Detailed Description

Provide support for 2D sketches.

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

Definition in file g_sketch.c.


Define Documentation

#define RT_SKETCH_SEG_MISS SEG   )     (SEG).seg_stp=RT_SOLTAB_NULL
 

Definition at line 177 of file g_sketch.c.


Function Documentation

fastf_t rt_cnurb_par_edge const struct edge_g_cnurb crv,
fastf_t  epsilon
 

Definition at line 168 of file nurb_tess.c.

References bu_bomb(), bu_log(), edge_g_cnurb::order, edge_g_cnurb::pt_type, and RT_NURB_EXTRACT_COORDS.

Here is the call graph for this function:

int rt_check_curve struct curve *  crv,
struct rt_sketch_internal skt,
int  noisey
 

Definition at line 67 of file g_sketch.c.

References nurb_seg::ctl_points, CURVE_CARC_MAGIC, CURVE_LSEG_MAGIC, CURVE_NURB_MAGIC, carc_seg::end, carc_seg::start, and rt_sketch_internal::vert_count.

Referenced by rt_extrude_prep().

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

R T _ S K E T C H _ P R E P

Given a pointer to a GED database record, and a transformation matrix, determine if this is a valid SKETCH, and if so, precompute various terms of the formula.

Returns - 0 SKETCH is OK !0 Error in description

Implicit return - A struct sketch_specific is created, and it's address is stored in stp->st_specific for use by sketch_shot().

Definition at line 145 of file g_sketch.c.

References NULL, and soltab::st_specific.

void rt_sketch_print register const struct soltab stp  ) 
 

R T _ S K E T C H _ P R I N T

Definition at line 156 of file g_sketch.c.

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

R T _ S K E T C H _ S H O T

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

Returns - 0 MISS >0 HIT

Definition at line 172 of file g_sketch.c.

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

R T _ S K E T C H _ V S H O T

Vectorized version.

Definition at line 186 of file g_sketch.c.

References rt_vstub().

Here is the call graph for this function:

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

R T _ S K E T C H _ N O R M

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

Definition at line 203 of file g_sketch.c.

References VJOIN1.

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

R T _ S K E T C H _ C U R V E

Return the curvature of the sketch.

Definition at line 216 of file g_sketch.c.

References bn_vec_ortho().

Here is the call graph for this function:

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

R T _ S K E T C H _ U V

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

Definition at line 234 of file g_sketch.c.

void rt_sketch_free register struct soltab stp  ) 
 

R T _ S K E T C H _ F R E E

Definition at line 243 of file g_sketch.c.

int rt_sketch_class void   ) 
 

R T _ S K E T C H _ C L A S S

Definition at line 252 of file g_sketch.c.

int seg_to_vlist struct bu_list vhead,
const struct rt_tess_tol ttol,
fastf_t V,
fastf_t u_vec,
fastf_t v_vec,
struct rt_sketch_internal sketch_ip,
genptr_t  seg
 

Definition at line 258 of file g_sketch.c.

References rt_tess_tol::abs, BN_VLIST_LINE_DRAW, BN_VLIST_LINE_MOVE, bu_log(), carc_seg::center_is_left, CURVE_CARC_MAGIC, CURVE_LSEG_MAGIC, carc_seg::end, line_seg::end, M_PI, MAGNITUDE, rt_tess_tol::norm, carc_seg::orientation, carc_seg::radius, rt_tess_tol::rel, RT_ADD_VLIST, SMALL_FASTF, carc_seg::start, line_seg::start, V2JOIN1, V2MOVE, V2SUB2, VCROSS, rt_sketch_internal::vert_count, rt_sketch_internal::verts, VJOIN2, VSCALE, VSUB2, VUNITIZE, X, and Y.

Here is the call graph for this function:

int curve_to_vlist struct bu_list vhead,
const struct rt_tess_tol ttol,
fastf_t V,
fastf_t u_vec,
fastf_t v_vec,
struct rt_sketch_internal sketch_ip,
struct curve *  crv
 

C U R V E _ T O _ V L I S T

Definition at line 682 of file g_sketch.c.

References bu_debug, BU_DEBUG_MEM_CHECK, bu_log(), bu_mem_barriercheck(), and seg_to_vlist().

Referenced by rt_extrude_plot(), and rt_sketch_plot().

Here is the call graph for this function:

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

R T _ S K E T C H _ P L O T

Definition at line 712 of file g_sketch.c.

References bu_log(), curve_to_vlist(), rt_db_internal::idb_ptr, LOCAL, RT_CK_DB_INTERNAL, RT_SKETCH_CK_MAGIC, rt_sketch_internal::skt_curve, rt_sketch_internal::u_vec, rt_sketch_internal::V, and rt_sketch_internal::v_vec.

Here is the call graph for this function:

int rt_sketch_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 _ S K E T C H _ T E S S

Returns - -1 failure 0 OK. *r points to nmgregion that holds this tessellation.

Definition at line 741 of file g_sketch.c.

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

R T _ S K E T C H _ I M P O R T

Import an SKETCH from the database format to the internal format. Apply modeling transformations as well.

Definition at line 754 of file g_sketch.c.

References bu_calloc(), BU_CK_EXTERNAL, bu_debug, bu_glong(), bu_log(), bu_malloc(), bu_mem_barriercheck(), nurb_seg::c_size, carc_seg::center_is_left, nurb_seg::ctl_points, CURVE_CARC_MAGIC, CURVE_LSEG_MAGIC, CURVE_NURB_MAGIC, DB5_MAJORTYPE_BRLCAD, DBID_SKETCH, carc_seg::end, line_seg::end, bu_external::ext_buf, ID_SKETCH, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, nurb_seg::k, knot_vector::k_size, knot_vector::knots, LOCAL, nurb_seg::magic, carc_seg::magic, line_seg::magic, bezier_seg::magic, rt_sketch_internal::magic, MAT4X3PNT, MAT4X3VEC, ntohd(), NULL, nurb_seg::order, carc_seg::orientation, nurb_seg::pt_type, ptr, carc_seg::radius, RT_CK_DB_INTERNAL, RT_NURB_IS_PT_RATIONAL, RT_SKETCH_INTERNAL_MAGIC, rt_sketch_internal::curve::seg_count, rt_sketch_internal::curve::segments, record::skt, rt_sketch_internal::skt_curve, record::sketch_rec::skt_seg_count, record::sketch_rec::skt_uvec, record::sketch_rec::skt_V, record::sketch_rec::skt_vert_count, record::sketch_rec::skt_vvec, carc_seg::start, line_seg::start, record::u_id, rt_sketch_internal::u_vec, rt_sketch_internal::V, rt_sketch_internal::v_vec, rt_sketch_internal::vert_count, rt_sketch_internal::verts, and nurb_seg::weights.

Here is the call graph for this function:

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

R T _ S K E T C H _ E X P O R T

The name is added by the caller, in the usual place.

Definition at line 916 of file g_sketch.c.

References bu_bomb(), BU_CK_EXTERNAL, bu_debug, bu_log(), bu_mem_barriercheck(), nurb_seg::c_size, CURVE_BEZIER_MAGIC, CURVE_CARC_MAGIC, CURVE_LSEG_MAGIC, CURVE_NURB_MAGIC, bezier_seg::degree, record::i, ID_SKETCH, rt_db_internal::idb_ptr, nurb_seg::k, knot_vector::k_size, nurb_seg::pt_type, ptr, RT_CK_DB_INTERNAL, RT_NURB_IS_PT_RATIONAL, RT_SKETCH_CK_MAGIC, rt_sketch_internal::curve::seg_count, rt_sketch_internal::curve::segments, rt_sketch_internal::skt_curve, and rt_sketch_internal::vert_count.

Here is the call graph for this function:

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

R T _ S K E T C H _ I M P O R T 5

Import an SKETCH from the database format to the internal format. Apply modeling transformations as well.

Definition at line 1108 of file g_sketch.c.

References bu_calloc(), BU_CK_EXTERNAL, bu_debug, bu_glong(), bu_log(), bu_malloc(), bu_mem_barriercheck(), nurb_seg::c_size, carc_seg::center_is_left, nurb_seg::ctl_points, CURVE_CARC_MAGIC, CURVE_LSEG_MAGIC, CURVE_NURB_MAGIC, DB5_MAJORTYPE_BRLCAD, carc_seg::end, line_seg::end, bu_external::ext_buf, ID_SKETCH, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, nurb_seg::k, knot_vector::k_size, knot_vector::knots, LOCAL, nurb_seg::magic, carc_seg::magic, line_seg::magic, bezier_seg::magic, rt_sketch_internal::magic, MAT4X3PNT, MAT4X3VEC, ntohd(), NULL, nurb_seg::order, carc_seg::orientation, nurb_seg::pt_type, carc_seg::radius, RT_CK_DB_INTERNAL, RT_NURB_IS_PT_RATIONAL, RT_SKETCH_INTERNAL_MAGIC, rt_sketch_internal::curve::seg_count, rt_sketch_internal::curve::segments, SIZEOF_NETWORK_DOUBLE, SIZEOF_NETWORK_LONG, rt_sketch_internal::skt_curve, carc_seg::start, line_seg::start, rt_sketch_internal::u_vec, rt_sketch_internal::V, rt_sketch_internal::v_vec, rt_sketch_internal::vert_count, rt_sketch_internal::verts, and nurb_seg::weights.

Here is the call graph for this function:

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

R T _ S K E T C H _ E X P O R T 5

The name is added by the caller, in the usual place.

Definition at line 1270 of file g_sketch.c.

References bu_bomb(), BU_CK_EXTERNAL, bu_debug, bu_log(), bu_malloc(), bu_mem_barriercheck(), bu_plong(), nurb_seg::c_size, CURVE_BEZIER_MAGIC, CURVE_CARC_MAGIC, CURVE_LSEG_MAGIC, CURVE_NURB_MAGIC, bezier_seg::degree, bu_external::ext_buf, bu_external::ext_nbytes, htond(), ID_SKETCH, rt_db_internal::idb_ptr, nurb_seg::k, knot_vector::k_size, nurb_seg::pt_type, RT_CK_DB_INTERNAL, RT_NURB_IS_PT_RATIONAL, RT_SKETCH_CK_MAGIC, rt_sketch_internal::curve::seg_count, rt_sketch_internal::curve::segments, SIZEOF_NETWORK_DOUBLE, SIZEOF_NETWORK_LONG, rt_sketch_internal::skt_curve, rt_sketch_internal::u_vec, rt_sketch_internal::V, V2SCALE, rt_sketch_internal::v_vec, rt_sketch_internal::vert_count, rt_sketch_internal::verts, void(), and VSCALE.

Here is the call graph for this function:

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

R T _ S K E T C H _ D E S C R I B E

Make human-readable formatted presentation of this solid. First line describes type of solid. Additional lines are indented one tab, and give parameter values.

Definition at line 1464 of file g_sketch.c.

References bu_vls_strcat(), rt_db_internal::idb_ptr, RT_SKETCH_CK_MAGIC, rt_sketch_internal::V, V2INTCLAMPARGS, V3INTCLAMPARGS, and VSCALE.

Here is the call graph for this function:

void rt_curve_free struct curve *  crv  ) 
 

Definition at line 1679 of file g_sketch.c.

References bu_free(), bu_log(), bezier_seg::ctl_points, nurb_seg::ctl_points, CURVE_BEZIER_MAGIC, CURVE_CARC_MAGIC, CURVE_LSEG_MAGIC, CURVE_NURB_MAGIC, nurb_seg::k, knot_vector::knots, and nurb_seg::weights.

Referenced by rt_extrude_free(), and rt_sketch_ifree().

Here is the call graph for this function:

void rt_sketch_ifree struct rt_db_internal ip  ) 
 

R T _ S K E T C H _ I F R E E

Free the storage associated with the rt_db_internal version of this solid.

Definition at line 1732 of file g_sketch.c.

References bu_debug, bu_free(), bu_log(), bu_mem_barriercheck(), GENPTR_NULL, rt_db_internal::idb_ptr, rt_sketch_internal::magic, RT_CK_DB_INTERNAL, rt_curve_free(), RT_SKETCH_CK_MAGIC, rt_sketch_internal::skt_curve, and rt_sketch_internal::verts.

Referenced by rt_extrude_ifree().

Here is the call graph for this function:

void rt_copy_curve struct curve *  crv_out,
const struct curve *  crv_in
 

Definition at line 1767 of file g_sketch.c.

References bu_calloc(), bu_malloc(), nurb_seg::c_size, nurb_seg::ctl_points, CURVE_CARC_MAGIC, CURVE_LSEG_MAGIC, CURVE_NURB_MAGIC, nurb_seg::pt_type, RT_NURB_IS_PT_RATIONAL, and nurb_seg::weights.

Referenced by rt_copy_sketch().

Here is the call graph for this function:

struct rt_sketch_internal* rt_copy_sketch const struct rt_sketch_internal sketch_ip  ) 
 

Definition at line 1838 of file g_sketch.c.

References bu_calloc(), bu_debug, bu_log(), bu_malloc(), bu_mem_barriercheck(), rt_copy_curve(), RT_SKETCH_CK_MAGIC, rt_sketch_internal::skt_curve, V2MOVE, rt_sketch_internal::vert_count, and rt_sketch_internal::verts.

Referenced by rt_extrude_xform().

Here is the call graph for this function:

int curve_to_tcl_list struct bu_vls vls,
struct curve *  crv
 

Definition at line 1873 of file g_sketch.c.

References bu_vls_printf(), and CURVE_LSEG_MAGIC.

Referenced by rt_sketch_tclget().

Here is the call graph for this function:

int rt_sketch_tclform const struct rt_functab ftp,
Tcl_Interp interp
 

Definition at line 1933 of file g_sketch.c.

References interp, RT_CK_FUNCTAB, and TCL_OK.

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

Definition at line 1945 of file g_sketch.c.

References bu_vls_free(), bu_vls_init(), bu_vls_printf(), bu_vls_strcat(), bu_vls_strcpy(), curve_to_tcl_list(), rt_db_internal::idb_ptr, NULL, RT_SKETCH_CK_MAGIC, TCL_ERROR, V2ARGS, and V3ARGS.

Here is the call graph for this function:

int get_tcl_curve Tcl_Interp interp,
struct curve *  crv,
Tcl_Obj seg_list
 

Definition at line 2024 of file g_sketch.c.

References bu_calloc(), interp, and type.

Referenced by rt_sketch_tcladjust().

Here is the call graph for this function:

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

Definition at line 2216 of file g_sketch.c.

References bu_free(), get_tcl_curve(), rt_db_internal::idb_ptr, interp, NULL, RT_CK_DB_INTERNAL, RT_SKETCH_CK_MAGIC, rt_sketch_internal::curve::seg_count, rt_sketch_internal::skt_curve, TCL_ERROR, tcl_list_to_fastf_array(), TCL_OK, TCL_STATIC, rt_sketch_internal::u_vec, rt_sketch_internal::V, rt_sketch_internal::v_vec, rt_sketch_internal::vert_count, and rt_sketch_internal::verts.

Here is the call graph for this function:

void rt_curve_reverse_segment long *  lng  ) 
 

Definition at line 2345 of file g_sketch.c.

References carc_seg::center_is_left, bezier_seg::ctl_points, CURVE_BEZIER_MAGIC, CURVE_CARC_MAGIC, CURVE_LSEG_MAGIC, bezier_seg::degree, carc_seg::end, line_seg::end, carc_seg::orientation, carc_seg::radius, carc_seg::start, and line_seg::start.

void rt_curve_order_segments struct curve *  crv  ) 
 

Definition at line 2385 of file g_sketch.c.

References get_indices().

Here is the call graph for this function:


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