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

Go to the source code of this file.

Data Structures

struct  hyp_specific
 

Macros

#define HYP_NORM_BODY   (1) /* compute normal */
 
#define HYP_NORM_TOP   (2) /* copy hyp_Hunit */
 
#define HYP_NORM_BOTTOM   (3) /* copy -hyp_Hunit */
 

Functions

struct hyp_specifichyp_internal_to_specific (struct rt_hyp_internal *hyp_in)
 
int rt_hyp_bbox (struct rt_db_internal *ip, point_t *min, point_t *max, const struct bn_tol *tol)
 
int rt_hyp_prep (struct soltab *stp, struct rt_db_internal *ip, struct rt_i *rtip)
 
void rt_hyp_print (const struct soltab *stp)
 
int rt_hyp_shot (struct soltab *stp, struct xray *rp, struct application *ap, struct seg *seghead)
 
void rt_hyp_norm (struct hit *hitp, struct soltab *stp, struct xray *rp)
 
void rt_hyp_curve (struct curvature *cvp, struct hit *hitp, struct soltab *stp)
 
void rt_hyp_uv (struct application *ap, struct soltab *stp, struct hit *hitp, struct uvcoord *uvp)
 
void rt_hyp_free (struct soltab *stp)
 
int rt_hyp_plot (struct bu_list *vhead, struct rt_db_internal *incoming, const struct rt_tess_tol *ttol, const struct bn_tol *tol, const struct rt_view_info *info)
 
int rt_hyp_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_hyp_import5 (struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip)
 
int rt_hyp_export5 (struct bu_external *ep, const struct rt_db_internal *ip, double local2mm, const struct db_i *dbip)
 
int rt_hyp_describe (struct bu_vls *str, const struct rt_db_internal *ip, int verbose, double mm2local)
 
void rt_hyp_ifree (struct rt_db_internal *ip)
 
int rt_hyp_params (struct pc_pc_set *ps, const struct rt_db_internal *ip)
 
void rt_hyp_centroid (point_t *cent, const struct rt_db_internal *ip)
 
void rt_hyp_surf_area (fastf_t *area, const struct rt_db_internal *ip)
 
void rt_hyp_volume (fastf_t *volume, const struct rt_db_internal *ip)
 

Variables

const struct bu_structparse rt_hyp_parse []
 

Detailed Description

Intersect a ray with an elliptical hyperboloid of one sheet.

[ (x*x) / (r1*r1) ] + [ (y*y) / (r2*r2) ] - [ (z*z) * (c*c) / (r1*r1) ] = 1

r1: semi-major axis, along Au r2: semi-minor axis, along Au x H c: slope of asymptotic cone in the Au-H plane

Definition in file hyp.c.

Macro Definition Documentation

#define HYP_NORM_BODY   (1) /* compute normal */

Definition at line 229 of file hyp.c.

Referenced by rt_hyp_curve(), rt_hyp_norm(), rt_hyp_shot(), and rt_hyp_uv().

#define HYP_NORM_TOP   (2) /* copy hyp_Hunit */

Definition at line 230 of file hyp.c.

Referenced by rt_hyp_curve(), rt_hyp_norm(), rt_hyp_shot(), and rt_hyp_uv().

#define HYP_NORM_BOTTOM   (3) /* copy -hyp_Hunit */

Definition at line 231 of file hyp.c.

Referenced by rt_hyp_curve(), rt_hyp_norm(), rt_hyp_shot(), and rt_hyp_uv().

Function Documentation

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

Create a bounding RPP for an hyp

Definition at line 121 of file hyp.c.

References rt_db_internal::idb_ptr, RT_CK_DB_INTERNAL, and VSETALL.

Referenced by rt_hyp_prep().

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

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

Returns - 0 HYP is OK !0 Error in description

Implicit return - A struct hyp_specific is created, and its address is stored in stp->st_specific for use by hyp_shot().

Definition at line 183 of file hyp.c.

References hyp_specific::hyp_c, hyp_specific::hyp_H, hyp_internal_to_specific(), hyp_specific::hyp_r1, hyp_specific::hyp_V, ID_HYP, rt_db_internal::idb_ptr, OBJ, RT_CK_DB_INTERNAL, rt_hyp_bbox(), rt_i::rti_tol, soltab::st_aradius, soltab::st_bradius, soltab::st_center, soltab::st_id, soltab::st_max, soltab::st_meth, soltab::st_min, and soltab::st_specific.

Here is the call graph for this function:

void rt_hyp_print ( const struct soltab stp)
int rt_hyp_shot ( struct soltab stp,
struct xray rp,
struct application ap,
struct seg seghead 
)

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

Returns - 0 MISS >0 HIT

Definition at line 243 of file hyp.c.

References application::a_resource, BU_LIST_INSERT, bu_log(), hit::hit_dist, hyp_specific::hyp_Aunit, hyp_specific::hyp_bounds, hyp_specific::hyp_Bunit, hyp_specific::hyp_Hmag, hyp_specific::hyp_Hunit, HYP_NORM_BODY, HYP_NORM_BOTTOM, HYP_NORM_TOP, hyp_specific::hyp_rx, hyp_specific::hyp_ry, hyp_specific::hyp_rz, hyp_specific::hyp_V, seg::l, NEAR_ZERO, xray::r_dir, xray::r_pt, RT_GET_SEG, RT_HIT_MAGIC, RT_PCOEF_TOL, soltab::st_specific, X, Y, and Z.

Here is the call graph for this function:

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

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

Definition at line 412 of file hyp.c.

References bu_log(), hit::hit_dist, hit::hit_normal, hit::hit_point, hit::hit_surfno, hit::hit_vpriv, hyp_specific::hyp_Aunit, hyp_specific::hyp_Bunit, hyp_specific::hyp_Hunit, HYP_NORM_BODY, HYP_NORM_BOTTOM, HYP_NORM_TOP, hyp_specific::hyp_rx, hyp_specific::hyp_ry, hyp_specific::hyp_rz, xray::r_dir, xray::r_pt, soltab::st_specific, VSET, X, Y, and Z.

Here is the call graph for this function:

void rt_hyp_curve ( struct curvature cvp,
struct hit hitp,
struct soltab stp 
)

Return the curvature of the hyp.

Definition at line 459 of file hyp.c.

References bn_vec_ortho(), curvature::crv_c1, curvature::crv_c2, curvature::crv_pdir, hit::hit_normal, hit::hit_surfno, hit::hit_vpriv, hyp_specific::hyp_c, HYP_NORM_BODY, HYP_NORM_BOTTOM, HYP_NORM_TOP, hyp_specific::hyp_rx, hyp_specific::hyp_ry, soltab::st_specific, X, Y, and Z.

Here is the call graph for this function:

void rt_hyp_uv ( struct application ap,
struct soltab stp,
struct hit hitp,
struct uvcoord uvp 
)

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

u = azimuth v = elevation

Definition at line 535 of file hyp.c.

References hit::hit_surfno, hit::hit_vpriv, hyp_specific::hyp_Hmag, HYP_NORM_BODY, HYP_NORM_BOTTOM, HYP_NORM_TOP, hyp_specific::hyp_r1, hyp_specific::hyp_r2, hyp_specific::hyp_rx, hyp_specific::hyp_ry, hyp_specific::hyp_rz, if(), M_PI, RT_CK_APPLICATION, soltab::st_specific, uvcoord::uv_du, uvcoord::uv_dv, uvcoord::uv_u, uvcoord::uv_v, X, Y, and Z.

Here is the call graph for this function:

void rt_hyp_free ( struct soltab stp)

Definition at line 581 of file hyp.c.

References BU_PUT, and soltab::st_specific.

int rt_hyp_plot ( struct bu_list vhead,
struct rt_db_internal incoming,
const struct rt_tess_tol ttol,
const struct bn_tol tol,
const struct rt_view_info info 
)

Definition at line 591 of file hyp.c.

References BN_VLIST_LINE_DRAW, BN_VLIST_LINE_MOVE, BU_CK_LIST_HEAD, BU_PUT, hyp_specific::hyp_Au, hyp_specific::hyp_c, hyp_specific::hyp_H, hyp_internal_to_specific(), hyp_specific::hyp_r1, hyp_specific::hyp_r2, hyp_specific::hyp_V, rt_db_internal::idb_ptr, M_SQRT1_2, RT_ADD_VLIST, RT_CK_DB_INTERNAL, and VSETALL.

Here is the call graph for this function:

int rt_hyp_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_hyp_import5 ( struct rt_db_internal ip,
const struct bu_external ep,
const mat_t  mat,
const struct db_i dbip 
)

Import an HYP from the database format to the internal format. Note that the data read will be in network order. This means Big-Endian integers and IEEE doubles for floating point.

Apply modeling transformations as well.

Definition at line 1187 of file hyp.c.

References bn_mat_identity, BU_ALLOC, BU_ASSERT_LONG, BU_CK_EXTERNAL, bu_cv_ntohd(), bu_external::ext_buf, bu_external::ext_nbytes, ID_HYP, rt_db_internal::idb_major_type, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, OBJ, RT_CK_DB_INTERNAL, RT_CK_DBI, RT_HYP_INTERNAL_MAGIC, SIZEOF_NETWORK_DOUBLE, and ZERO.

Here is the call graph for this function:

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

Export an HYP from internal form to external format. Note that this means converting all integers to Big-Endian format and floating point data to IEEE double.

Apply the transformation to mm units as well.

Definition at line 1239 of file hyp.c.

References bu_calloc(), BU_CK_EXTERNAL, bu_cv_htond(), bu_external::ext_buf, bu_external::ext_nbytes, ID_HYP, rt_db_internal::idb_ptr, RT_CK_DB_INTERNAL, RT_CK_DBI, and SIZEOF_NETWORK_DOUBLE.

Here is the call graph for this function:

int rt_hyp_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 1281 of file hyp.c.

References bu_vls_strcat(), rt_db_internal::idb_ptr, X, Y, and Z.

Here is the call graph for this function:

void rt_hyp_ifree ( struct rt_db_internal ip)

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

Definition at line 1327 of file hyp.c.

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

Here is the call graph for this function:

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

Definition at line 1343 of file hyp.c.

References RT_CK_DB_INTERNAL.

void rt_hyp_centroid ( point_t *  cent,
const struct rt_db_internal ip 
)

Definition at line 1352 of file hyp.c.

References rt_db_internal::idb_ptr, and RT_CK_DB_INTERNAL.

void rt_hyp_surf_area ( fastf_t area,
const struct rt_db_internal ip 
)

only the stub to make analyze happy TODO: needs an implementation

Definition at line 1372 of file hyp.c.

void rt_hyp_volume ( fastf_t volume,
const struct rt_db_internal ip 
)

Definition at line 1376 of file hyp.c.

References bu_free(), hyp_specific::hyp_c, hyp_specific::hyp_Hmag, hyp_internal_to_specific(), hyp_specific::hyp_r1, hyp_specific::hyp_r2, rt_db_internal::idb_ptr, and RT_CK_DB_INTERNAL.

Here is the call graph for this function:

Variable Documentation

const struct bu_structparse rt_hyp_parse[]
Initial value:
= {
{ "%f", 3, "V", bu_offsetofarray(struct rt_hyp_internal, hyp_Vi, fastf_t, X), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{ "%f", 3, "H", bu_offsetofarray(struct rt_hyp_internal, hyp_Hi, fastf_t, X), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{ "%f", 3, "A", bu_offsetofarray(struct rt_hyp_internal, hyp_A, fastf_t, X), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{ "%f", 1, "b", bu_offsetof(struct rt_hyp_internal, hyp_b), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{ "%f", 1, "bnr", bu_offsetof(struct rt_hyp_internal, hyp_bnr), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{ {'\0', '\0', '\0', '\0'}, 0, (char *)NULL, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
Definition: color.c:49
#define bu_offsetofarray(_t, _a, _d, _i)
Definition: parse.h:65
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153
#define bu_offsetof(_t, _m)
Definition: parse.h:64
double fastf_t
Definition: defines.h:300

Definition at line 108 of file hyp.c.