home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: Graphics
/
Graphics.zip
/
povsrc31.zip
/
sphsweep.h
< prev
next >
Wrap
Text File
|
1998-10-09
|
3KB
|
101 lines
/****************************************************************************
* sphsweep.h
*
* This module contains the global defines, typedefs, and prototypes
* for sphsweep.c.
*
* Copyright 1997 Jochen Lippert
*
*****************************************************************************/
#ifndef SPHERE_SWEEP_H
#define SPHERE_SWEEP_H
/*****************************************************************************
* Global preprocessor defines
******************************************************************************/
#define SPHERE_SWEEP_OBJECT (BASIC_OBJECT)
/* Sphere sweep interpolated by a piecewise linear function */
#define LINEAR_SPHERE_SWEEP 0
/* Sphere sweep interpolated by a cubic Catmull-Rom-Spline function */
#define CATMULL_ROM_SPLINE_SPHERE_SWEEP 1
/* Sphere sweep approximated by a cubic B-Spline function */
#define B_SPLINE_SPHERE_SWEEP 2
/* Maximum number of coefficients of the polynomials describing one segment */
#define SPH_SWP_MAX_COEFS 4
/*****************************************************************************
* Global typedefs
******************************************************************************/
typedef struct Sphere_Sweep_Struct SPHERE_SWEEP;
typedef struct Sphere_Sweep_Sphere_Struct SPHSWEEP_SPH;
typedef struct Sphere_Sweep_Segment_Struct SPHSWEEP_SEG;
/* The complete object */
struct Sphere_Sweep_Struct
{
OBJECT_FIELDS
TRANSFORM *Trans;
int Interpolation;
int Num_Modeling_Spheres; /* Number of modeling spheres */
SPHSWEEP_SPH *Modeling_Sphere; /* Spheres describing the shape */
int Num_Spheres; /* Number of single spheres */
SPHSWEEP_SPH *Sphere; /* Spheres that close segments */
int Num_Segments; /* Number of tubular segments */
SPHSWEEP_SEG *Segment; /* Tubular segments */
DBL Depth_Tolerance; /* Preferred depth tolerance */
};
/* Single sphere, used to connect two adjacent segments */
struct Sphere_Sweep_Sphere_Struct
{
VECTOR Center;
DBL Radius;
};
/* One segment of the sphere sweep */
struct Sphere_Sweep_Segment_Struct
{
SPHSWEEP_SPH Closing_Sphere[2]; /* Spheres closing the segment */
VECTOR Center_Deriv[2]; /* Derivatives of center funcs for 0 and 1 */
DBL Radius_Deriv[2]; /* Derivatives of radius funcs for 0 and 1 */
int Num_Coefs; /* Number of coefficients */
VECTOR Center_Coef[SPH_SWP_MAX_COEFS]; /* Coefs of center polynomial */
DBL Radius_Coef[SPH_SWP_MAX_COEFS]; /* Coefs of radius polynomial */
};
/*****************************************************************************
* Global variables
******************************************************************************/
/*****************************************************************************
* Global functions
******************************************************************************/
SPHERE_SWEEP *Create_Sphere_Sweep (void);
void Compute_Sphere_Sweep_BBox (SPHERE_SWEEP *Sphere_Sweep);
int Intersect_Sphere_Sweep (RAY *Ray, VECTOR Center, DBL Radius2, DBL *Depth1, DBL *Depth2);
void *Copy_Sphere_Sweep (OBJECT *Object);
void Transform_Sphere_Sweep (OBJECT *Object, TRANSFORM *Trans);
void Destroy_Sphere_Sweep (OBJECT *Object);
void Compute_Sphere_Sweep (SPHERE_SWEEP *Sphere_Sweep);
#endif