Developer documentation | Axl-2.5.1

axlSphere.h
Go to the documentation of this file.
1 /* axlSphere.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 sphere.
14  * In this case, we have to create three double directly instead of table
15  */
16 
17 /* Change log:
18  *
19  */
20 
21 #ifndef AXLSPHERE_H
22 #define AXLSPHERE_H
23 
24 #include "axlCoreExport.h"
25 
26 #include "axlAbstractData.h"
27 #include "axlPoint.h"
28 
29 #include <QtCore>
30 
31 class axlSpherePrivate;
32 
34 {
35  Q_OBJECT
36  Q_PROPERTY(double radius READ radius WRITE touchRadius);
37  Q_PROPERTY(axlPoint center READ centerPoint WRITE touchCenter);
38 
39 public:
40  axlSphere(QObject *parent = 0);
41  axlSphere(double x, double y, double z=0, double radius = 1.0, QObject *parent = 0);
42  axlSphere(const axlSphere& other);
43  ~axlSphere(void);
44 
45  virtual QString description(void) const;
46  virtual QString identifier(void) const;
47 
48  double x(void) const;
49  double y(void) const;
50  double z(void) const;
51  double *coordinates(void) const;
52  double radius(void) const;
53  void setRadius(double radius);
54  void touchRadius(double radius);
55  void touchCenter(axlPoint center);
56  axlPoint centerPoint(void);
57 
58  void setValues(double x, double y, double z, double radius);
59  void setCenter(double x, double y, double z);
60 
61  void normalize();
62 
63  axlSphere& operator =(const axlSphere& other);
64  axlSphere& operator+=(const axlSphere& other);
65  axlSphere& operator-=(const axlSphere& other);
66  axlSphere& operator*=(double scalar);
67  axlSphere& operator/=(double scalar);
68 
69  axlSphere operator+(const axlSphere& other) const;
70  axlSphere operator-(const axlSphere& other) const;
71  axlSphere operator*(double scalar) const;
72  axlSphere operator/(double scalar) const;
73 
74  friend QDebug operator<<(QDebug dbg, axlSphere sphere);
75  friend QDebug operator<<(QDebug dbg, axlSphere& sphere);
76  friend QDebug operator<<(QDebug dbg, axlSphere *sphere);
77 
78  //IPC
79  QVariantList convertDataToQVariant(void) const;
80  int convertQVariantToData(const QVariantList &data);
81 
82  //void emitDataChanged(void);
83 
84 //signals :
85 // void dataChanged(void);
86 
87 public slots:
88  void onXChanged(double x);
89  void onYChanged(double y);
90  void onZChanged(double z);
91  void onRadiusChanged(double radius);
92 
93 public:
94  static double distance(const axlSphere& lhs, const axlSphere& rhs);
95  static double distance( axlSphere *lhs, axlSphere *rhs);
96 
97 
98 private:
99  axlSpherePrivate *d;
100 };
102 
103 //to be registered to the data factory.
104 dtkAbstractData *createaxlSphere(void);
105 
106 // /////////////////////////////////////////////////////////////////
107 // Debug operators
108 // /////////////////////////////////////////////////////////////////
109 
110 QDebug operator<<(QDebug dbg, axlSphere sphere);
111 QDebug operator<<(QDebug dbg, axlSphere& sphere);
112 QDebug operator<<(QDebug dbg, axlSphere *sphere);
113 
114 #endif // AXLSPHERE_H
dtkAbstractData * createaxlSphere(void)
Definition: axlSphere.cpp:447
Class axlPoint defines 3D points.
Definition: axlPoint.h:34
Q_DECLARE_METATYPE(axlAbstractData)
QDebug operator<<(QDebug dbg, axlSphere sphere)
Definition: axlSphere.cpp:361
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...
virtual QVariantList convertDataToQVariant(void) const
Convert an axlAbstractData into a QVariantList that specifies all properties of the axlAbstractData...
Class axlSphere defines 3D spheres.
Definition: axlSphere.h:33
#define AXLCORE_EXPORT
Class axlAbstractData defines an API for all type of axel data.