[1097] | 1 | #ifndef MXGEOM3D_INCLUDED // -*- C++ -*-
|
---|
| 2 | #define MXGEOM3D_INCLUDED
|
---|
| 3 | #if !defined(__GNUC__)
|
---|
| 4 | # pragma once
|
---|
| 5 | #endif
|
---|
| 6 |
|
---|
| 7 | /************************************************************************
|
---|
| 8 |
|
---|
| 9 | Handy 3D geometrical primitives
|
---|
| 10 |
|
---|
| 11 | Copyright (C) 1998 Michael Garland. See "COPYING.txt" for details.
|
---|
| 12 |
|
---|
| 13 | $Id: MxGeom3D.h,v 1.1 2002/09/24 16:53:54 wimmer Exp $
|
---|
| 14 |
|
---|
| 15 | ************************************************************************/
|
---|
| 16 |
|
---|
| 17 | #include "MxVec3.h"
|
---|
| 18 | #include "MxVec4.h"
|
---|
| 19 |
|
---|
| 20 | extern double triangle_area(const Vec3&, const Vec3&, const Vec3&);
|
---|
| 21 | extern Vec3 triangle_raw_normal(const Vec3&, const Vec3&, const Vec3&);
|
---|
| 22 | extern Vec3 triangle_normal(const Vec3&, const Vec3&, const Vec3&);
|
---|
| 23 | extern Vec4 triangle_plane(const Vec3&, const Vec3&, const Vec3&);
|
---|
| 24 | extern Vec4 triangle_raw_plane(const Vec3&, const Vec3&, const Vec3&);
|
---|
| 25 | extern double triangle_compactness(const Vec3&, const Vec3&, const Vec3&);
|
---|
| 26 |
|
---|
| 27 | extern double triangle_project_point(const Vec3& v0, const Vec3& v1,
|
---|
| 28 | const Vec3& v2, const Vec3& v,
|
---|
| 29 | Vec3 *bary=NULL);
|
---|
| 30 |
|
---|
| 31 | extern void mx3d_box_corners(const Vec3& min, const Vec3& max, Vec3 *v);
|
---|
| 32 |
|
---|
| 33 | class MxBounds
|
---|
| 34 | {
|
---|
| 35 | public:
|
---|
| 36 |
|
---|
| 37 | Vec3 min, max;
|
---|
| 38 | Vec3 center;
|
---|
| 39 | double radius;
|
---|
| 40 | unsigned int points;
|
---|
| 41 |
|
---|
| 42 | void reset();
|
---|
| 43 | void add_point(const double *v, bool will_update=true);
|
---|
| 44 | void add_point(const float *v, bool will_update=true);
|
---|
| 45 | void complete();
|
---|
| 46 | void merge(const MxBounds&);
|
---|
| 47 |
|
---|
| 48 | MxBounds() { reset(); }
|
---|
| 49 | };
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | // MXGEOM3D_INCLUDED
|
---|
| 54 | #endif
|
---|