Developer documentation | Axl-2.5.1

axlPoint.h
Go to the documentation of this file.
1 /* axlPoint.h ---
2  *
3  * Author: Meriadeg Perrinel
4  * Copyright (C) 2008 - Meriadeg Perrinel, Inria.
5  * Created: Tue Nov 9 16:58:59 2010 (+0100)
6  * Version: $Id$
7  * Last-Updated: Mon Dec 6 15:46:18 2010 (+0100)
8  * By: Meriadeg Perrinel
9  * Update #: 21
10  */
11 
12 /* Commentary:
13  * There is choice table for stock coordinate. But maybe that is nos the good solution if algorithm behin use a lot of point.
14  * In this case, we have to create three double directly instead of table
15  */
16 
17 /* Change log:
18  *
19  */
20 
21 #ifndef AXLPOINT_H
22 #define AXLPOINT_H
23 
24 #include "axlCoreExport.h"
25 
26 #include "axlAbstractData.h"
27 
28 #include <QtCore>
29 #include <QObject>
30 #include <QMetaType>
31 
32 class axlPointPrivate;
33 
35 {
36  Q_OBJECT
37  Q_PROPERTY(double x READ x WRITE touchX);
38  Q_PROPERTY(double y READ y WRITE touchY);
39  Q_PROPERTY(double z READ z WRITE touchZ);
40 
41 public:
42  axlPoint(QObject *parent = 0);
43  axlPoint(double x, double y, double z=0, QObject *parent = 0);
44  axlPoint(const axlPoint& other);
45  axlPoint(const axlPoint *other);
46  axlPoint(double *p, QObject *parent = 0);
47 
48  ~axlPoint(void);
49 
50  virtual QString description(void) const;
51  virtual QString identifier(void) const;
52 
53 
54  double x(void) const;
55  double y(void) const;
56  double z(void) const;
57  double operator [] (int i) const;
58 
59  double& x(void);
60  double& y(void);
61  double& z(void);
62  double& operator [] (int i);
63 
64  double *coordinates(void) const;
65 
66  double norm(void) const;
67 
68  void setCoordinates(double x, double y, double z);
69  //void updateCoordinates(double x, double y, double z);
70 
71  void touchX(double x);
72  void touchY(double y);
73  void touchZ(double z);
74 
75  void normalize(void);
76  axlPoint& normalized(void);
77 
78  bool isEqualTo(axlPoint *point);
79 
80  axlPoint& operator =(const axlPoint& other);
81  axlPoint& operator+=(const axlPoint& other);
82  axlPoint& operator-=(const axlPoint& other);
83  double operator* (const axlPoint& other) const;
84  axlPoint& operator*=(double scalar);
85  axlPoint& operator/=(double scalar);
86 
87  axlPoint operator+(const axlPoint& other) const;
88  axlPoint operator-(const axlPoint& other) const;
89  axlPoint operator*(double scalar) const;
90  axlPoint operator/(double scalar) const;
91 
92  void transformAsPoint(double matrix[12]);
93  void transformAsVector(double matrix[12]);
94 
95  bool operator<(const axlPoint& other) const;
96 
97  bool operator==(const axlPoint& point2) const;
98  bool operator!=(const axlPoint& point2) const;
99 
100  friend QDebug operator<<(QDebug dbg, axlPoint point);
101  friend QDebug operator<<(QDebug dbg, axlPoint& point);
102  friend QDebug operator<<(QDebug dbg, axlPoint *point);
103 
104  //converter method for qjson-rpc communication.
105  QVariantList convertDataToQVariant(void) const;
106  int convertQVariantToData(const QVariantList &data);
107 
108 //public slots:
109 // void onXChanged(double x);
110 // void onYChanged(double y);
111 // void onZChanged(double z);
112 
113 public:
114  static double distance(const axlPoint& lhs, const axlPoint& rhs);
115  static double distance( axlPoint *lhs, axlPoint *rhs);
116 
117  static axlPoint crossProduct(const axlPoint& lhs, const axlPoint& rhs);
118  static axlPoint* crossProduct( axlPoint *lhs, axlPoint *rhs);
119 
120  static double dotProduct(const axlPoint& lhs, const axlPoint& rhs);
121  static double dotProduct( axlPoint *lhs, axlPoint *rhs);
122 
123 
124 private:
125  axlPointPrivate *d;
126 };
128 
129 dtkAbstractData *createaxlPoint(void);
130 
131 // /////////////////////////////////////////////////////////////////
132 // Debug operators
133 // /////////////////////////////////////////////////////////////////
134 
135 QDebug operator<<(QDebug dbg, axlPoint point);
136 QDebug operator<<(QDebug dbg, axlPoint& point);
137 QDebug operator<<(QDebug dbg, axlPoint *point);
138 #endif // AXLPOINT_H
Class axlPoint defines 3D points.
Definition: axlPoint.h:34
void normalize(axlPoint &point)
virtual int convertQVariantToData(const QVariantList &data)
Modify properties and geometry variables of the axlAbstractData. Return 1 if the modification was suc...
QDebug operator<<(QDebug dbg, axlPoint point)
Definition: axlPoint.cpp:521
dtkAbstractData * createaxlPoint(void)
Definition: axlPoint.cpp:599
virtual QVariantList convertDataToQVariant(void) const
Convert an axlAbstractData into a QVariantList that specifies all properties of the axlAbstractData...
#define AXLCORE_EXPORT
Q_DECLARE_METATYPE(axlPoint)
Class axlAbstractData defines an API for all type of axel data.