Geom Software - C++ Programming and Geometry Libraries
Fade3D Documentation pages v0.99
/home/geom/repo/dev/geomDev/dt3/dt3Library/Point3.h
1 
2 // Copyright (C) Geom Software e.U, Bernhard Kornberger, Graz/Austria
3 //
4 // This file is part of the Fade3D library. The student license is free
5 // of charge and covers personal non-commercial research. Licensees
6 // holding a commercial license may use this file in accordance with
7 // the Commercial License Agreement.
8 //
9 // This software is provided AS IS with NO WARRANTY OF ANY KIND,
10 // INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
11 // FOR A PARTICULAR PURPOSE.
12 //
13 // Please contact the author if any conditions of this licensing are
14 // not clear to you.
15 //
16 // Author: Bernhard Kornberger, bkorn (at) geom.at
17 // https://www.geom.at
18 
19 #pragma once
20 #include <iostream>
21 #include <float.h>
22 #include "definitions.h"
23 
24 namespace FADE3D {
25 
26 
27 class Tet3; // FWD
28 class Vector3; // FWD
32 class CLASS_DECLSPEC Point3
33 {
34  friend class Tet3;
35  friend class HC3;
36  friend struct Validator;
37 public:
42  Point3();
47  Point3(const double x,const double y,const double z);
52  Point3(const Point3& p_);
53  ~Point3();
54 
57  double x() const;
58 
61  double y() const;
62 
65  double z() const;
68  void xyz(double& x_,double& y_,double& z_) const;
69 
75  Tet3* getOneTet() const;
77  void init(const Point3& p);
79  void setOneTet(Tet3* pc);
80 
81 
82  void exchange(double x,double y,double z);
83  void debug();
84 
85  //void setCustomIndex(int customIndex_);
86  int getCustomIndex();
87 
92  bool operator<(const Point3& p) const;
93 
98  bool operator==(const Point3& p) const;
99 
100  Vector3 operator-(const Point3& other) const;
101  Point3 operator+(const Vector3& vec) const;
102 
103  friend std::ostream &operator<<(std::ostream &stream, const Point3& pnt);
104  friend std::istream &operator>>(std::istream &stream, Point3& pnt);
105 //#ifdef GEOM_DEV_DEBUG
107 //*/
108  //static int runningCtr;
109  //int label;
111 //*/
112 //#endif
113 
114 
115 
116 
117 protected:
118  double coordX;
119  double coordY;
120  double coordZ;
121  Tet3* pAssociatedTet;
122  int customIndex;
123 };
124 
125 
126 // FREE FUNCTIONS
127 
130 inline
131 double sqDistance(const Point3& p0,const Point3& p1)
132 {
133  double deltaX=p1.x()-p0.x();
134  double deltaY=p1.y()-p0.y();
135  double deltaZ=p1.z()-p0.z();
136  return (deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
137 }
138 
141 inline
142 double sqDistance(const double x0,const double y0,const double z0,const Point3& p1)
143 {
144  double deltaX=p1.x()-x0;
145  double deltaY=p1.y()-y0;
146  double deltaZ=p1.z()-z0;
147  return (deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
148 }
149 
150 
151 } // NAMESPACE FADE3D
152 
153 
Definition: Ball3.h:16
double y() const
Get the y coordinate.
double z() const
Get the u coordinate.
Vertex.
Definition: Point3.h:32
double coordX
Definition: Point3.h:118
Tetrahedron.
Definition: Tet3.h:46
3D Vector
Definition: Vector3.h:26
double x() const
Get the x coordinate.