source: sasview/src/sans/simulation/geoshapespy/libgeoshapespy/Point3D.h @ aa639ea

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since aa639ea was aa639ea, checked in by Mathieu Doucet <doucetm@…>, 11 years ago

Move simulation code (unused)

  • Property mode set to 100644
File size: 2.1 KB
Line 
1//class point3D    1/29/2004 Jing
2//properties: copy point coordinates
3//            calculate point to point distance
4//            shortest distance from a point to a line
5
6
7#ifndef __POINT3D_
8#define __POINT3D_
9
10#include <iostream>
11#include <vector>
12
13using namespace std;
14
15const double pi = 3.1415926;
16
17class Point3D
18{
19  public:
20        Point3D() {}
21
22        //assign values with SLD to a point
23        Point3D(double a, double b, double c, double sld = 0);
24
25        // output
26        friend std::ostream& operator<<(std::ostream&, const Point3D&);
27
28        //distance to a point
29        double distanceToPoint(const Point3D &p) const;
30       
31        //distance to a line
32        double distanceToLine(const Point3D &p1, const Point3D &p2, bool *pv = 0) const; 
33
34        // get the point lying on the axis from a point
35        Point3D getInterPoint(const Point3D &p1, const Point3D &p2, bool *pv = 0) const;
36
37        // normalization
38        Point3D normVector() const;
39
40        // get length
41        double norm() const;
42       
43        double normalize();
44       
45        // assignment operator
46        Point3D& operator=(const Point3D &p);
47       
48        // scale this point with s
49        void scale(double s);
50       
51        // multiplication product of two vectors
52        Point3D multiplyProduct(const Point3D &p);
53
54        // p0 - p
55        Point3D minus(const Point3D &p) const;
56
57        // p0 + p
58        Point3D plus(const Point3D &p) const;
59
60        // dot product
61        double dotProduct(const Point3D &p) const;
62
63        //if you do not care if the point falls into the range of line,you can directly use distanceToLine(p1,p2)
64        void set(double x1, double y1, double z1);
65
66        double getX() const { return x; }
67        double getY() const { return y; }
68        double getZ() const { return z; }
69        double getSLD() const { return sld_; }
70
71        //Transformation
72        void Transform(const vector<double> &orien, const vector<double> &center);
73        void TransformMatrix(const vector<double> &rotmatrix, const vector<double> &center);
74  private:
75        double x, y, z;
76        double sld_;
77
78        void RotateX(const double ang_x);
79        void RotateY(const double ang_y);
80        void RotateZ(const double ang_z);
81        void Translate(const double trans_x, const double trans_y, const double trans_z);
82        double Degree2Radian(const double degree);
83};
84
85typedef std::vector<Point3D> Point3DVector;
86
87#endif
Note: See TracBrowser for help on using the repository browser.