BRL-CAD
#include "common.h"
#include <math.h>
#include "bio.h"
#include "vmath.h"
#include "db.h"
#include "nmg.h"
#include "rtgeom.h"
#include "raytrace.h"
#include "../../librt_private.h"
Include dependency graph for poly.c:

Go to the source code of this file.

Macros

#define TRI_NULL   ((struct tri_specific *)0)
 
#define MAXHITS   128 /* # surfaces hit, must be even */
 

Functions

HIDDEN int rt_pgface (struct soltab *stp, fastf_t *ap, fastf_t *bp, fastf_t *cp, const struct bn_tol *tol)
 
int rt_pg_bbox (struct rt_db_internal *ip, point_t *min, point_t *max, const struct bn_tol *tol)
 
int rt_pg_prep (struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
 
void rt_pg_print (const struct soltab *stp)
 
int rt_pg_shot (struct soltab *stp, struct xray *rp, struct application *ap, struct seg *seghead)
 
void rt_pg_free (struct soltab *stp)
 
void rt_pg_norm (struct hit *hitp, struct soltab *stp, struct xray *rp)
 
void rt_pg_uv (struct application *ap, struct soltab *stp, struct hit *hitp, struct uvcoord *uvp)
 
int rt_pg_plot (struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info)
 
int rt_pg_plot_poly (struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
 
void rt_pg_curve (struct curvature *cvp, struct hit *hitp, struct soltab *stp)
 
int rt_pg_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_pg_import4 (struct rt_db_internal *ip, const struct bu_external *ep, const fastf_t *mat, const struct db_i *dbip)
 
int rt_pg_export4 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
 
int rt_pg_import5 (struct rt_db_internal *ip, const struct bu_external *ep, const fastf_t *mat, const struct db_i *dbip)
 
int rt_pg_export5 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
 
int rt_pg_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local)
 
void rt_pg_ifree (struct rt_db_internal *ip)
 
int rt_pg_params (struct pc_pc_set *ps, const struct rt_db_internal *ip)
 
int rt_pg_to_bot (struct rt_db_internal *ip, const struct bn_tol *tol, struct resource *resp)
 

Detailed Description

Intersect a ray with a Polygonal Object that has no explicit topology. It is assumed that the solid has no holes.

Definition in file poly.c.

Macro Definition Documentation

#define TRI_NULL   ((struct tri_specific *)0)

Definition at line 44 of file poly.c.

Referenced by rt_pg_free(), and rt_pg_print().

#define MAXHITS   128 /* # surfaces hit, must be even */

Referenced by rt_pg_shot().

Function Documentation

HIDDEN int rt_pgface ( struct soltab stp,
fastf_t ap,
fastf_t bp,
fastf_t cp,
const struct bn_tol tol 
)

This function is called with pointers to 3 points, and is used to prepare PG faces. ap, bp, cp point to vect_t points.

Return - 0 if the 3 points didn't form a plane (e.g., collinear, etc.).

pts (3) if a valid plane resulted.

Definition at line 160 of file poly.c.

References BU_GET, bu_log(), BU_PUT, DEBUG_ARB8, RT_G_DEBUG, soltab::st_specific, tri_specific::tri_A, tri_specific::tri_BA, tri_specific::tri_CA, tri_specific::tri_forw, tri_specific::tri_N, and tri_specific::tri_wn.

Referenced by rt_pg_prep().

Here is the call graph for this function:

int rt_pg_bbox ( struct rt_db_internal ip,
point_t *  min,
point_t *  max,
const struct bn_tol tol 
)

Calculate the bounding RPP for a poly

Definition at line 54 of file poly.c.

References rt_db_internal::idb_ptr, and VSETALL.

Referenced by rt_pg_prep().

int rt_pg_prep ( struct soltab stp,
struct rt_db_internal ip,
struct rt_i rtip 
)

This routine is used to prepare a list of planar faces for being shot at by the triangle routines.

Process a PG, which is represented as a vector from the origin to the first point, and many vectors from the first point to the remaining points.

Definition at line 97 of file poly.c.

References bu_log(), rt_db_internal::idb_ptr, rt_pg_bbox(), rt_pgface(), rt_i::rti_tol, soltab::st_aradius, soltab::st_bradius, soltab::st_center, soltab::st_max, soltab::st_min, soltab::st_specific, X, Y, and Z.

Here is the call graph for this function:

void rt_pg_print ( const struct soltab stp)

Definition at line 201 of file poly.c.

References bu_log(), if(), soltab::st_specific, tri_specific::tri_A, tri_specific::tri_BA, tri_specific::tri_CA, tri_specific::tri_forw, tri_specific::tri_N, TRI_NULL, tri_specific::tri_wn, and VPRINT.

Here is the call graph for this function:

int rt_pg_shot ( struct soltab stp,
struct xray rp,
struct application ap,
struct seg seghead 
)

Function - Shoot a ray at a polygonal object.

Returns - 0 MISS >0 HIT

Definition at line 232 of file poly.c.

References application::a_resource, application::a_rt_i, OSL::Strings::alpha, BU_LIST_INSERT, bu_log(), bn_tol::dist, seg::l, MAXHITS, NEAR_ZERO, xray::r_dir, xray::r_pt, RT_GET_SEG, RT_HIT_MAGIC, rt_hitsort(), rt_i::rti_tol, seg::seg_in, seg::seg_out, seg::seg_stp, SQRT_SMALL_FASTF, soltab::st_specific, tri_specific::tri_A, tri_specific::tri_BA, tri_specific::tri_CA, tri_specific::tri_forw, tri_specific::tri_N, tri_specific::tri_surfno, tri_specific::tri_wn, and V3ARGS.

Here is the call graph for this function:

void rt_pg_free ( struct soltab stp)

Definition at line 446 of file poly.c.

References BU_PUT, soltab::st_specific, tri_specific::tri_forw, and TRI_NULL.

void rt_pg_norm ( struct hit hitp,
struct soltab stp,
struct xray rp 
)

Definition at line 461 of file poly.c.

References RT_CK_HIT, RT_CK_RAY, and RT_CK_SOLTAB.

void rt_pg_uv ( struct application ap,
struct soltab stp,
struct hit hitp,
struct uvcoord uvp 
)
void rt_pg_curve ( struct curvature cvp,
struct hit hitp,
struct soltab stp 
)

Definition at line 554 of file poly.c.

References bn_vec_ortho(), curvature::crv_c1, curvature::crv_c2, curvature::crv_pdir, hit::hit_normal, RT_CK_HIT, and RT_CK_SOLTAB.

Here is the call graph for this function:

int rt_pg_tess ( struct nmgregion **  r,
struct model *  m,
struct rt_db_internal ip,
const struct rt_tess_tol ttol,
const struct bn_tol tol 
)

Definition at line 567 of file poly.c.

References bu_free(), BU_LIST_FIRST, bu_log(), bu_malloc(), rt_db_internal::idb_ptr, nmg_calc_face_g(), nmg_cmface(), nmg_find_pt_in_shell(), nmg_fix_normals(), nmg_mrsv(), nmg_pr_fu_briefly(), nmg_region_a(), nmg_vertex_gv(), RT_CK_DB_INTERNAL, and s.

Referenced by rt_pg_brep().

Here is the call graph for this function:

int rt_pg_import4 ( struct rt_db_internal ip,
const struct bu_external ep,
const fastf_t mat,
const struct db_i dbip 
)

Read all the polygons in as a complex dynamic structure. The caller is responsible for freeing the dynamic memory. (vid rt_pg_ifree).

Definition at line 643 of file poly.c.

References bn_mat_identity, BU_ALLOC, BU_CK_EXTERNAL, bu_log(), bu_malloc(), db_i::dbi_version, bu_external::ext_buf, bu_external::ext_nbytes, flip_fastf_float(), ID_POLY, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, if(), OBJ, RT_CK_DB_INTERNAL, RT_CK_DBI, and RT_PG_INTERNAL_MAGIC.

Here is the call graph for this function:

int rt_pg_export4 ( struct bu_external ep,
const struct rt_db_internal ip,
double  local2mm,
const struct db_i dbip 
)

The name will be added by the caller. Generally, only libwdb will set conv2mm != 1.0

Definition at line 725 of file poly.c.

References bu_calloc(), BU_CK_EXTERNAL, bu_log(), bu_external::ext_buf, bu_external::ext_nbytes, ID_POLY, rt_db_internal::idb_ptr, RT_CK_DB_INTERNAL, and RT_CK_DBI.

Here is the call graph for this function:

int rt_pg_import5 ( struct rt_db_internal ip,
const struct bu_external ep,
const fastf_t mat,
const struct db_i dbip 
)

Definition at line 776 of file poly.c.

References bu_log(), RT_CK_DB_INTERNAL, and RT_CK_DBI.

Here is the call graph for this function:

int rt_pg_export5 ( struct bu_external ep,
const struct rt_db_internal ip,
double  local2mm,
const struct db_i dbip 
)

Definition at line 791 of file poly.c.

References bu_log(), RT_CK_DB_INTERNAL, and RT_CK_DBI.

Here is the call graph for this function:

int rt_pg_describe ( struct bu_vls str,
const struct rt_db_internal ip,
int  verbose,
double  mm2local 
)

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 811 of file poly.c.

References rt_db_internal::idb_ptr.

void rt_pg_ifree ( struct rt_db_internal ip)

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

Definition at line 866 of file poly.c.

References bu_free(), rt_db_internal::idb_ptr, and RT_CK_DB_INTERNAL.

Here is the call graph for this function:

int rt_pg_params ( struct pc_pc_set ps,
const struct rt_db_internal ip 
)

Definition at line 891 of file poly.c.

References RT_CK_DB_INTERNAL.