g_metaball.c File Reference

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

Include dependency graph for g_metaball.c:

Go to the source code of this file.

Defines

#define STEPBACK   { distleft += step; VSUB2(p, p, inc); step *= .5; VSCALE(inc,inc,.5); }
#define STEPIN(x)   { --segsleft; ++retval; VSUB2(delta, p, rp->r_pt); segp->seg_##x.hit_dist = MAGNITUDE(delta); }

Functions

fastf_t rt_metaball_get_bounding_sphere (point_t *center, fastf_t threshold, struct bu_list *points)
int rt_metaball_prep (struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
void rt_metaball_print (register const struct soltab *stp)
fastf_t rt_metaball_point_value (point_t *p, struct bu_list *points)
int rt_metaball_shot (struct soltab *stp, register struct xray *rp, struct application *ap, struct seg *seghead)
void rt_metaball_norm (register struct hit *hitp, struct soltab *stp, register struct xray *rp)
void rt_metaball_curve (register struct curvature *cvp, register struct hit *hitp, struct soltab *stp)
void rt_metaball_uv (struct application *ap, struct soltab *stp, register struct hit *hitp, register struct uvcoord *uvp)
void rt_metaball_free (register struct soltab *stp)
int rt_metaball_class (void)
void rt_metaball_plot_sph (struct bu_list *vhead, point_t *center, fastf_t radius)
int rt_metaball_plot (struct bu_list *vhead, struct rt_db_internal *ip, const struct rt_tess_tol *ttol, const struct bn_tol *tol)
int rt_metaball_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_metaball_import5 (struct rt_db_internal *ip, const struct bu_external *ep, register const fastf_t *mat, const struct db_i *dbip)
int rt_metaball_export5 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
int rt_metaball_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local)
void rt_metaball_ifree (struct rt_db_internal *ip)
int rt_metaball_tnurb (struct nmgregion **r, struct model *m, struct rt_db_internal *ip, const struct bn_tol *tol)


Detailed Description

Intersect a ray with a metaball implicit surface.

NOTICE: this primitive is incomplete and should be considered experimental.

Authors - Erik Greenwald <erikg@arl.army.mil>

Source - ARL/SLAD/SDB Bldg 238 The U. S. Army Ballistic Research Laboratory Aberdeen Proving Ground, Maryland 21005

Definition in file g_metaball.c.


Define Documentation

#define STEPBACK   { distleft += step; VSUB2(p, p, inc); step *= .5; VSCALE(inc,inc,.5); }
 

Referenced by rt_metaball_shot().

#define STEPIN x   )     { --segsleft; ++retval; VSUB2(delta, p, rp->r_pt); segp->seg_##x.hit_dist = MAGNITUDE(delta); }
 

Referenced by rt_metaball_shot().


Function Documentation

fastf_t rt_metaball_get_bounding_sphere point_t center,
fastf_t  threshold,
struct bu_list points
 

Definition at line 75 of file g_metaball.c.

References BU_LIST_FOR, wdb_metaballpt::coord, INFINITY, and VSETALL.

Referenced by rt_metaball_plot(), and rt_metaball_prep().

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

R T _ M E T A B A L L _ P R E P

prep and build bounding volumes... unfortunately, generating the bounding sphere is too 'loose' (I think) and O(n^2).

Definition at line 126 of file g_metaball.c.

References BU_LIST_FOR, BU_LIST_INIT, BU_LIST_INSERT, bu_malloc(), wdb_metaballpt::coord, wdb_metaballpt::fldstr, rt_db_internal::idb_ptr, wdb_metaballpt::l, rt_metaball_internal::metaball_ctrl_head, RT_METABALL_CK_MAGIC, rt_metaball_get_bounding_sphere(), soltab::st_aradius, soltab::st_bradius, soltab::st_center, soltab::st_max, soltab::st_min, soltab::st_specific, rt_metaball_internal::threshold, VMOVE, VSET, X, Y, and Z.

Here is the call graph for this function:

void rt_metaball_print register const struct soltab stp  ) 
 

R T _ M E T A B A L L _ P R I N T

Definition at line 169 of file g_metaball.c.

References bu_log().

Here is the call graph for this function:

fastf_t rt_metaball_point_value point_t p,
struct bu_list points
 

Definition at line 176 of file g_metaball.c.

References BU_LIST_FOR, wdb_metaballpt::coord, wdb_metaballpt::fldstr, MAGSQ, and VSUB2.

Referenced by rt_metaball_shot().

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

Definition at line 193 of file g_metaball.c.

References application::a_onehit, application::a_resource, BU_LIST_INSERT, seg::l, rt_metaball_internal::metaball_ctrl_head, NULL, RT_GET_SEG, rt_metaball_point_value(), soltab::st_aradius, soltab::st_specific, STEPBACK, STEPIN, rt_metaball_internal::threshold, VADD2, VJOIN1, VSCALE, and VSUB2.

Here is the call graph for this function:

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

R T _ M E T A B A L L _ N O R M

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

Definition at line 255 of file g_metaball.c.

References BU_LIST_FOR, wdb_metaballpt::coord, wdb_metaballpt::fldstr, MAGNITUDE, rt_metaball_internal::metaball_ctrl_head, soltab::st_specific, VJOIN1, VSETALL, VSUB2, and VUNITIZE.

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

R T _ M E T A B A L L _ C U R V E

Return the curvature of the metaball.

Definition at line 281 of file g_metaball.c.

References bu_log().

Here is the call graph for this function:

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

R T _ M E T A B A L L _ U V

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

Definition at line 297 of file g_metaball.c.

References bu_log().

Here is the call graph for this function:

void rt_metaball_free register struct soltab stp  ) 
 

R T _ M E T A B A L L _ F R E E

Definition at line 307 of file g_metaball.c.

References bu_log().

Here is the call graph for this function:

int rt_metaball_class void   ) 
 

Definition at line 317 of file g_metaball.c.

References RT_CLASSIFY_UNIMPLEMENTED.

void rt_metaball_plot_sph struct bu_list vhead,
point_t center,
fastf_t  radius
 

Definition at line 324 of file g_metaball.c.

References BN_VLIST_LINE_DRAW, BN_VLIST_LINE_MOVE, ELEMENTS_PER_VECT, RT_ADD_VLIST, rt_ell_16pts(), top(), and VSET.

Referenced by rt_metaball_plot().

Here is the call graph for this function:

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

R T _ M E T A B A L L _ P L O T

Definition at line 349 of file g_metaball.c.

References BU_LIST_FOR, wdb_metaballpt::coord, wdb_metaballpt::fldstr, rt_db_internal::idb_ptr, rt_metaball_internal::metaball_ctrl_head, RT_CK_DB_INTERNAL, RT_METABALL_CK_MAGIC, rt_metaball_get_bounding_sphere(), rt_metaball_plot_sph(), and rt_metaball_internal::threshold.

Here is the call graph for this function:

int rt_metaball_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 _ M E T A B A L L _ T E S S

Tessellate a metaball.

Definition at line 372 of file g_metaball.c.

References bu_log().

Here is the call graph for this function:

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

R T _ M E T A B A L L _ I M P O R T 5

Import an metaball/sphere from the database format to the internal structure. Apply modeling transformations as well.

Definition at line 385 of file g_metaball.c.

References BU_CK_EXTERNAL, BU_GETSTRUCT, bu_glong(), BU_LIST_INIT, BU_LIST_INSERT, bu_malloc(), wdb_metaballpt::coord, DB5_MAJORTYPE_BRLCAD, bu_external::ext_buf, wdb_metaballpt::fldstr, ID_METABALL, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, wdb_metaballpt::l, bu_list::magic, rt_metaball_internal::magic, MAT4X3PNT, rt_metaball_internal::metaball_ctrl_head, rt_metaball_internal::method, ntohd(), RT_CK_DB_INTERNAL, RT_METABALL_INTERNAL_MAGIC, SIZEOF_NETWORK_DOUBLE, SIZEOF_NETWORK_LONG, rt_metaball_internal::threshold, and WDB_METABALLPT_MAGIC.

Here is the call graph for this function:

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

R T _ M E T A B A L L _ E X P O R T 5

storage is something like long numpoints fastf_t threshold long method fastf_t X1 (start point) fastf_t Y1 fastf_t Z1 fastf_t fldstr1 (end point) fastf_t X2 (start point) ...

Definition at line 435 of file g_metaball.c.

References BU_CK_EXTERNAL, BU_LIST_FOR, bu_malloc(), bu_plong(), wdb_metaballpt::coord, bu_external::ext_buf, bu_external::ext_nbytes, wdb_metaballpt::fldstr, ID_METABALL, rt_db_internal::idb_ptr, bu_list::magic, rt_metaball_internal::metaball_ctrl_head, rt_metaball_internal::method, RT_CK_DB_INTERNAL, RT_METABALL_CK_MAGIC, SIZEOF_NETWORK_DOUBLE, SIZEOF_NETWORK_LONG, rt_metaball_internal::threshold, and VSCALE.

Here is the call graph for this function:

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

R T _ M E T A B A L L _ 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 479 of file g_metaball.c.

References BU_LIST_FOR, bu_vls_strcat(), wdb_metaballpt::coord, wdb_metaballpt::fldstr, rt_db_internal::idb_ptr, rt_metaball_internal::metaball_ctrl_head, RT_CK_DB_INTERNAL, RT_METABALL_CK_MAGIC, rt_metaball_internal::threshold, and V3ARGS.

Here is the call graph for this function:

void rt_metaball_ifree struct rt_db_internal ip  ) 
 

R T _ M E T A B A L L _ I F R E E

Free the storage associated with the rt_db_internal version of this solid. This only effects the in-memory copy.

Definition at line 510 of file g_metaball.c.

References bu_free(), BU_LIST_DEQUEUE, BU_LIST_WHILE, GENPTR_NULL, rt_db_internal::idb_ptr, wdb_metaballpt::l, bu_list::magic, rt_metaball_internal::metaball_ctrl_head, RT_CK_DB_INTERNAL, and RT_METABALL_CK_MAGIC.

Here is the call graph for this function:

int rt_metaball_tnurb struct nmgregion **  r,
struct model m,
struct rt_db_internal ip,
const struct bn_tol tol
 

R T _ M E T A B A L L _ T N U R B

Definition at line 532 of file g_metaball.c.

References bu_log().

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