Cyclone 3DR Script
from Technodigit, part of Hexagon. Copyright 1997-2022.
 
Loading...
Searching...
No Matches
SMultiLine.h
1
2
3
5
6#pragma once
7
8#include "RshPluginScript/RshPluginScriptDefines.h"
9#include "RshGeometry/Old/RshScanner.h"
10#include "RshPluginScript/SClass/SComp.h"
11
12#ifndef FCT_DOC
13namespace rsh::ScriptBinding
14{
15#endif // !FCT_DOC
16
23class SMultiline : public SComp
24{
25 //======================================================================================================================
26 // INTERNAL FUNCTION
27 //======================================================================================================================
28
29 //======================================================================================================================
30 // DOCUMENTED FUNCTION
31 //======================================================================================================================
32public:
37 {
38 // representations which are always available
39 MULTILINE_SEGMENTS, // only segments are displayed
40 MULTILINE_VERTICES, // segments and vertices are displayed
41 MULTILINE_INSPECTION, // Colors ares based on an inspection value on each point.
42 // only available if the polyline contains inspection information
43
44 };
45
46
51 {
52 OTHER_SIDE, // The side where point is not.
53 SAME_SIDE// The side where point is.
54 };
55
59 {
60 SMOOTH_TYPE1, // order 1 filter. Very smooth filter. The small radii are becoming greater.
61 SMOOTH_TYPE2, // order 2 filter. More complex filter based on first derivative that allows to limit
62 // as much as possible increasing the radii.
63 SMOOTH_BSPLINE// B-spline smoothing.
64 };
65
69 {
70 SUPPRESS_SMALL_LOOPS_FIRST, // The suppression is done by suppressing from the smallest to the longest auto-intersection loops.
71 SUPPRESS_LONG_LOOPS_FIRST, // The suppression is done by suppressing from the longest to the smallest auto-intersection loops.
72 SUPPRESS_IN_VERTEX_ORDER// The suppression is done in the order we find them by browsing from the 1st to the last vertex.
73 };
74
75public slots: // these functions (slots) will be available in QtScript
76
77
80 String toString() ;
81
89 // TESTED
91 SPoint iPointToCopy,
93 Number AbsoluteAccuracy
97 );
98
106 // TESTED
108 SPoint iPointToCopy,
110 Number AbsoluteAccuracy
114 );
115
118 // TESTED
119 Number GetNumber() ;
120
123 // TESTED
124 Boolean IsClosed() ;
125
128 // TESTED
129 Boolean IsPlanar() ;
130
133 // TESTED
134 SPoint GetPoint(unsigned Index);
135
144 // TESTED
146 Number DistanceToOrigin,
148 Boolean InterpolateOnSegments
151 );
152
157 // TESTED
158 Number GetLength() ;
159
166 // TESTED
168
177 // TESTED
178 Array GetNormal() ;
179
186 // TESTED
189 );
190
197 // TESTED
200 );
201
208 // TESTED
211 );
212
215 // TESTED
217
220 // TESTED
222
228 // TESTED
230 Number nPoints,
232 Boolean makePlanarJunction
234 );
235
241 // TESTED
242 Array Smooth(
243 Number Para1,
251 Number SmoothIntens,
253 SmoothEnum SmoothingType,
266 Number MaxiDeviation
271 );
272
285 // TESTED
286 Array Offset(
287 SVector Direction,
291 Number DistOffset,
293 OffsetSideEnum GoodSide,
297 SPoint iSidePt
299 ) ;
300
317 // TESTED
318 Array Compare(
319 SMultiline iMeasuredMulti,
321 Number DistMax,
323 SVector
324 ProjectionDir = {},
326 Number MappingObject,
329 Boolean IgnoreEdge,
333 Boolean PtToPt,
336 Boolean InPlane
338 );
339
342 // TESTED
344 Number NbArrow,
347 Number Position
350 );
351
354 // TESTED
356 Boolean Reverse
360 );
361
364 // TESTED
366
372 // TESTED
373 Array Reduce(
374 unsigned NbPoint,
377 Number MaxDeviation,
381 Boolean OptimizePosition
383 );
384
392 // TESTED
393 Array RightAngle(Number Threshold
395 );
396
417 Array Save(
418 String FilePath,
420 SMatrix CoordinateSystemMatrix = {}
423 );
424
429 // TESTED
430 SetLineWidth(Number width
432 );
433
440 Array GetColorGradient() { return SComp::GetColorGradient(); }
441
459 Array LoadColorGradient(String FilePath
461 )
462 {
463 return SComp::LoadColorGradient(FilePath);
464 }
465
483 Array SaveColorGradient(String FilePath
485 )
486 {
487 return SComp::SaveColorGradient(FilePath);
488 }
489
499 Array ClosestPoint(SPoint iPoint
501 );
502
513 Array Proj3D(SPoint iPoint
515 ) ;
516
528 Array ProjDir(
529 SPoint iThePnt,
531 SVector ProjDir,
533 Number Aperture
536 ) ;
537
551 Number GetArea( SVector ProjDir
553 ) ;
554
570 Array MultilineArea( SVector iProjDir) ;
571
575 // TESTED
576 Array GetDeviation(Number iIndex
577 ) ;
578
585 // TESTED
587
590 // TESTED
593 );
594
602 Number iLenghtTol
604 );
605
615 Number iLengthTol,
618 Number iLoopMaxLength =
619 -1,
622 );
623
633 Number iLengthTol
635 );
636
639 // TESTED
640 ShowName(Boolean iShowName
642 );
643};
644
645// @brief
646// this class allow to wrap static function to SMultiline easily
647// this allow to wrap constructor more easily the constructor will be declared with the function New(...)
648class SMultiline
649#ifndef FCT_DOC
650 : public SObjectStatic
651#endif // FCT_DOC
652{
653 //======================================================================================================================
654 // INTERNAL FUNCTION
655 //======================================================================================================================
656 //======================================================================================================================
657 // DOCUMENTED FUNCTION
658 //======================================================================================================================
659public slots:
662 // TESTED
663 static SMultiline New();
664
667 // TESTED
668 static SMultiline New(SMultiline iOther);
669
679 static Array FromClick() { return SComp::GetFromClick<SMultiline>(SV_MULTI); }
680
684 // TESTED
685 static Array FromName( String Name) { return SComp::GetFromName<SMultiline>(Name); }
686
690 // TESTED
691 static Array FromSel();
692
696 // TESTED
697 static Array All(
698 Number VisCrit
703 )
704 {
705 return SComp::GetAll<SMultiline>(VisCrit);
706 }
707
722 // TESTED
723 Array FromFile(String FileName
725 );
726
739 // TESTED
740 static Array Chain(
741 Array<SMultiline> TableLine,
743 Number MaxiSegmentLength,
746 Number Accuracy,
749 Boolean Close
751 );
752
760 static Array Cut(SMultiline TheSelEdge, SPoint iPoint);
761
773 static Array CurvedJunction(
774 SMultiline iFirstMultiline,
776 SMultiline iSecondMultiline,
778 Number nPoints,
780 Boolean makePlanarJunction,
782 Boolean chainWithInput
784 );
785
792 // TESTED
793 static Array MedianLine(
794 Array<SMultiline> TableMulti,
796 Number NbPt
799 );
800
803 static String toString();
804
812 Array<SMultiline>
813 TableMulti,
815 Number DesiredAccuracy
817 );
818};
819Q_DECLARE_METATYPE(SMultiline::_SMultilineDummy);
820Q_DECLARE_METATYPE(SMultiline);
821
822#ifndef FCT_DOC
823} // namespace rsh::ScriptBinding
824#endif // !FCT_DOC
825
826#ifndef FCT_DOC
827namespace rsh::Script::ScriptConvert
828{
829template<>
830struct TblConvert<SMultiline>
831{
832 static char GetClassName() { return "SMultiline"; }
833
834 typedef rsh::ScriptBinding::SMultiline ScriptClass;
835 typedef SMultiline DCompClass;
836
837 static SMultiline GetGCompClass(SMultiline _iCompClass)
838 {
839 return _iCompClass.GetGMultiLine();
840 }
841
842 static SMultiline ForDCompConstructor(SMultiline _iEnt) { return _iEnt; }
843};
844#endif
845}
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
Class to store a multiline, that is: an ordered list of points. The SMultiline creation can be done b...
Definition: SMultiLine.h:24
static Array FromClick()
Launches a click interaction to select a SComp in the scene.
Definition: SMultiLine.h:679
Array GetAutoIntersections(Number iLenghtTol)
Check whether a multiline contains autointersections.
Array Save(String FilePath, SMatrix CoordinateSystemMatrix={})
Saves the Multiline into a file.
Number GetLength()
static SMultiline New(SMultiline iOther)
Constructs an SMultiline by copying the SMultiline Other.
Boolean IsPlanar()
Array Smooth(Number Para1, Number SmoothIntens, SmoothEnum SmoothingType, Number MaxiDeviation)
Recalculates new vertices to smooth the current SMultiLine.
Array GetNormal()
Calculates the normal plane of the current SMultiline.
Array Proj3D(SPoint iPoint)
Search the closest 3D projection of a 3D Point this MultiLine. The projection can occur on a segment ...
Array GetDeviations()
return all deviation values of the multiline
Array InsertLast(SPoint iPointToCopy, Number AbsoluteAccuracy)
A point is added at the END of the multiline.
Array IntersectionWithPlane(SPlane iPlane)
Calculate intersection with 1 plane.
static Array MedianLine(Array< SMultiline > TableMulti, Number NbPt)
To compute the median line between two lines.
Number GetArea(SVector ProjDir)
Computes the area of a closed SMultiline projected with a direction.
Close()
Close a MultiLine.
MultilineRepresentationTypeEnum
The different representation types for multilines. Use SMultiline.FLAT.
Definition: SMultiLine.h:37
@ MULTILINE_VERTICES
Definition: SMultiLine.h:40
@ MULTILINE_SEGMENTS
Definition: SMultiLine.h:39
@ MULTILINE_INSPECTION
Definition: SMultiLine.h:41
Array Compare(SMultiline iMeasuredMulti, Number DistMax, SVector ProjectionDir={}, Number MappingObject, Boolean IgnoreEdge, Boolean PtToPt, Boolean InPlane)
Calculates the distances between 2 SMultilines for further inspection purpose (color mapping).
Array LoadColorGradient(String FilePath)
Loads the color gradient from a file (*.rsi binary file).
Definition: SMultiLine.h:459
Array CloseWithCurvedJunction(Number nPoints, Boolean makePlanarJunction)
Close a MultiLine with a curved junction.
Array IntersectionWithOtherPlanarMulti(SMultiline iMulti)
Calculate intersections between 2 planar multilines.
Array Offset(SVector Direction, Number DistOffset, OffsetSideEnum GoodSide, SPoint iSidePt)
Computes the parallel contour of a SMultiline according to a direction.
Array SaveColorGradient(String FilePath)
Saves the color gradient into a file (*.rsi binary file).
Definition: SMultiLine.h:483
Boolean IsClosed()
static Array FromName(String Name)
Search all the component with the given name.
Definition: SMultiLine.h:685
Array RepairAutoIntersections(Number iLengthTol, Number iLoopMaxLength=-1, RepairAutoIntersectionPolicyEnum iPolicy)
Repair the autointersections if there were by suppressing the smallest loop bounded by autointersecti...
Array InsertFirst(SPoint iPointToCopy, Number AbsoluteAccuracy)
A point is added at the END of the multiline.
Array GetDeviation(Number iIndex)
Number GetNumber()
SetLineWidth(Number width)
Change the thickness of the line.
Array ProjDir(SPoint iThePnt, SVector ProjDir, Number Aperture)
Search the closest projection along a direction on this MultiLine. The projection can occur on a segm...
static SMultiline New()
Default constructor to create an empty new SMultiline.
Array ClosestPoint(SPoint iPoint)
Finds the point in the current multiline that is the closest from an input point.
static Array CurvedJunction(SMultiline iFirstMultiline, SMultiline iSecondMultiline, Number nPoints, Boolean makePlanarJunction, Boolean chainWithInput)
Creates a curved junction between two SMultiline. .
OffsetSideEnum
To know on which side the offset is computing depending of a define point.
Definition: SMultiLine.h:51
@ OTHER_SIDE
Definition: SMultiLine.h:52
AddArrows(Number NbArrow, Number Position)
Add some arrows along the SMultiline.
Array RightAngle(Number Threshold)
Modifies the vertex of the SMultiline in order to get Right angles on the SMultiline.
static Array Cut(SMultiline TheSelEdge, SPoint iPoint)
Cut all the SMultiline by creating new segments between nearest SMultiline extremities....
Reverse()
Reverse the current multiline.
static Array MultilinesIntersections(Array< SMultiline > TableMulti, Number DesiredAccuracy)
Function to compute the set of intersections between an arbitrary number of Multilines.
String toString()
Get the type of the variable.
SmoothEnum
Enum the smoothing type.
Definition: SMultiLine.h:59
@ SMOOTH_TYPE1
Definition: SMultiLine.h:60
@ SMOOTH_TYPE2
Definition: SMultiLine.h:61
Clear()
Clear to deallocate memory.
Array GetPointAtDistance(Number DistanceToOrigin, Boolean InterpolateOnSegments)
Returns the point at a given distance on the current SMultiline.
Array Reduce(unsigned NbPoint, Number MaxDeviation, Boolean OptimizePosition)
Reduces the current SMultiline to have a certain number of points while keeping the best points.
static Array FromSel()
To get all the selected SComp.
Array GetColorGradient()
To get the color gradient of the SMultiline.
Definition: SMultiLine.h:440
Array SuppressSmallLines(Number iLengthTol)
Define a multiline suppressing the lines which have a length smaller than a tolerance length.
ShowName(Boolean iShowName)
Control whether the name of the multiline is shown or not in the scene.
static Array Chain(Array< SMultiline > TableLine, Number MaxiSegmentLength, Number Accuracy, Boolean Close)
Chain all the SMultiline by creating new segments between nearest SMultiline extremities....
static String toString()
Get the type of the variable.
SPoint GetPoint(unsigned Index)
Array FromFile(String FileName)
SPoint GetCentroidLinear()
Returns the barycenter of the current line considering the line having a constant linear density all ...
AddArrows(Boolean Reverse)
Add two arrows at the extremities of the SMultiline.
RepairAutoIntersectionPolicyEnum
Enum the autointersection reparation policy.
Definition: SMultiLine.h:69
@ SUPPRESS_SMALL_LOOPS_FIRST
Definition: SMultiLine.h:70
@ SUPPRESS_LONG_LOOPS_FIRST
Definition: SMultiLine.h:71
Array MultilineArea(SVector iProjDir)
Computes the area of a closed SMultiline projected with a direction.
static Array All(Number VisCrit)
To get all the SComp in the document.
Definition: SMultiLine.h:697
Array IntersectionWithMesh(SPoly iPoly)
Calculate intersections with 1 poly.
SetMultilineRepresentation(MultilineRepresentationTypeEnum Representation)
The representation of the component is modified.
Plane manipulation class. The SPlane creation can be done by calling the static functions: .
Definition: SPlane.h:24
3D point manipulation class. The SPoint creation can be done by calling the static functions:
Definition: SPoint.h:23
The SPoly class provides triangular mesh(es) manipulation. The SPoly creation can be done by calling ...
Definition: SPoly.h:39
The mathematical object vector.
Definition: SVector3.h:26