Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SPoint.h
1
2
3
5
6#pragma once
7
8#include "RshPluginScript/RshPluginScriptDefines.h"
9#include "RshPluginScript/SClass/SComp.h"
10
11#ifndef FCT_DOC
12namespace rsh::ScriptBinding
13{
14#endif // !FCT_DOC
15
22class SPoint : public SComp
23{
24 //======================================================================================================================
25 // INTERNAL FUNCTION
26 //======================================================================================================================
27
28
29 //======================================================================================================================
30 // DOCUMENTED FUNCTION
31 //======================================================================================================================
32
33public slots: // These functions (slots) will be available in QtScript
36 // TESTED
37 Number GetX() ;
40 // TESTED
41 SetX(Number X);
42
45 // TESTED
46 Number GetY() ;
49 // TESTED
50 SetY(Number Y);
51
54 // TESTED
55 Number GetZ() ;
58 // TESTED
59 SetZ(Number Z);
60
65 // TESTED
66 Number Distance(SPoint iPtToCompare);
67
75 // TESTED
76 Boolean Equals(SPoint iPtToCompare) ;
77
82 // TESTED
83 SPoint Add(SPoint iPtToAdd);
84
89 // TESTED
90 SPoint Sub(SPoint iPtToSub);
91
96 // TESTED
97 SPoint Div(Number Scalar);
98
103 // TESTED
104 SPoint Mult(Number Scalar);
105
108 SetPointSize(Number pointSize
110 );
111
114 Number GetPointSize();
115
118 String toString() ;
119
122 ShowName(Boolean iShowName
124 );
125
128 String ValuesToString() ;
129};
130
131// @brief
132// this class allow to wrap static function to SPoint easily
133// this allow to wrap constructor more easily the constructor will be declared with the function New(...)
134class SPoint
135#ifndef FCT_DOC
136 : public SObjectStatic
137#endif // FCT_DOC
138{
139 //======================================================================================================================
140 // INTERNAL FUNCTION
141 //======================================================================================================================
142
143 //======================================================================================================================
144 // DOCUMENTED FUNCTION
145 //======================================================================================================================
146
147public slots:
151 static SPoint New();
152
155 // TESTED
156 static SPoint New(SPoint Other);
157
160 // TESTED
161 static SPoint New(
162 Number X,
164 Number Y,
166 Number Z
168 );
169
183 static Array FromClick();
184
188 // TESTED
189 static Array FromName( String Name) { return SComp::GetFromName<SPoint>(Name); }
190
194 // TESTED
195 static Array FromSel();
196
200 // TESTED
201 static Array All(
202 Number iVisCrit
207 );
208
225 // TESTED
226 static Array FromFile(String FileName
228 );
229
244 // TESTED
245 static Array Save(
246 String FilePath,
248 Array<SPoint> PointsToSave,
250 SMatrix CoordinateSystemMatrix = {}
253 );
254
257 static String toString();
258};
259
260Q_DECLARE_METATYPE(SPoint::_SPointDummy);
261Q_DECLARE_METATYPE(SPoint);
262
263#ifndef FCT_DOC
264} // namespace rsh::ScriptBinding
265#endif // !FCT_DOC
266
267#ifndef FCT_DOC
268namespace rsh::Script::ScriptConvert
269{
270template<>
271struct TblConvert<SPoint>
272{
273 static char GetClassName() { return "SPoint"; } // return the name of the script class mapped with
274
275 typedef SPoint ScriptClass;
277 typedef SPoint DCompClass;
278
279 static GPointComp GetGCompClass(SPoint _iCompClass)
280 {
281 return _iCompClass.Point;
282 } // return the SComp from the SComp _iCompClass
283
284 static SPoint ForDCompConstructor(SPoint _iEnt)
285 {
286 return _iEnt;
287 } // return the correct SComp to create a new SComp
288};
289#endif
290}
The SComp class is an abstract class. Use derived classes SCircle, SCylinder, SCloud,...
Definition: SComp.h:32
Matrix with 3 lines and 4 columns to make any transformation. This class should be used in order to a...
Definition: SMatrix.h:21
3D point manipulation class. The SPoint creation can be done by calling the static functions:
Definition: SPoint.h:23
Number GetZ()
SPoint Div(Number Scalar)
To calculate the division of a point by a scalar (to be able to do averages).
SPoint Add(SPoint iPtToAdd)
To calculate the sum of two points (to be able to do some averages)
SetPointSize(Number pointSize)
New point size.
static String toString()
Get the type of the variable.
SetZ(Number Z)
Sets the Z coordinate.
Number GetY()
static SPoint New(SPoint Other)
Constructs an SPoint by copying the SPoint Other.
SetX(Number X)
Sets the X coordinate.
static SPoint New()
Default constructor to create an empty new SPoint. X = Y = Z// TESTED.
static Array All(Number iVisCrit)
To get all the SComp in the document.
ShowName(Boolean iShowName)
Control whether the name of the point is shown or not in the scene.
static Array Save(String FilePath, Array< SPoint > PointsToSave, SMatrix CoordinateSystemMatrix={})
Saves points into a file. Supported extensions : .asc, .txt.
Number Distance(SPoint iPtToCompare)
Calculates the true distance between 'this' and PtToCompare.
String ValuesToString()
Get a string representation of the point.
SPoint Mult(Number Scalar)
To calculate the multiplication of a point by a scalar.
Number GetPointSize()
Return the current point size.
static SPoint New(Number X, Number Y, Number Z)
Constructs a new SPoint by defining its data.
Boolean Equals(SPoint iPtToCompare)
To test if two 3D points are equal or not.
SPoint Sub(SPoint iPtToSub)
To calculate the subtraction of two points.
static Array FromName(String Name)
Search all the component with the given name.
Definition: SPoint.h:189
static Array FromClick()
Launches a click interaction to select a SComp in the scene.
static Array FromSel()
To get all the selected SComp.
String toString()
Get the type of the variable.
static Array FromFile(String FileName)
Imports points from a file. Authorized file extensions : .asc, .txt.
Number GetX()
SetY(Number Y)
Sets the Y coordinate.