opennurbs_hatch.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #ifndef OPENNURBS_HATCH_H_INCLUDED
18 #define OPENNURBS_HATCH_H_INCLUDED
19 
20 /*
21  class ON_HatchLoop
22  /////////////////////////////////////////////////////////////////
23  Represents a 3d boundary loop curve
24 */
25 class ON_CLASS ON_HatchLoop
26 {
27 public:
28 #if defined(OPENNURBS_EXPORTS) || defined(OPENNURBS_IMPORTS)
29  // When the Microsoft CRT(s) is/are used, this is the best
30  // way to prevent crashes that happen when a hatch loop is
31  // allocated with new in one DLL and deallocated with
32  // delete in another DLL.
33 
34  // new/delete
35  void* operator new(size_t);
36  void operator delete(void*);
37 
38  // array new/delete
39  void* operator new[] (size_t);
40  void operator delete[] (void*);
41 
42  // in place new/delete
43  void* operator new(size_t,void*);
44  void operator delete(void*,void*);
45 #endif
46 
47  enum eLoopType
48  {
49  ltOuter = 0,
50  ltInner = 1,
51  };
52 
53  ON_HatchLoop();
54  ON_HatchLoop( ON_Curve* pCurve2d, eLoopType type = ltOuter);
55  ON_HatchLoop( const ON_HatchLoop& src);
56  ~ON_HatchLoop();
57 
58  ON_HatchLoop& operator=( const ON_HatchLoop& src);
59 
60  bool IsValid( ON_TextLog* text_log = nullptr ) const;
61  void Dump( ON_TextLog& ) const; // for debugging
62  bool Write( ON_BinaryArchive&) const;
63  bool Read( ON_BinaryArchive&);
64 
65  // Interface
66  /////////////////////////////////////////////////////////////////
67 
68  /*
69  Description:
70  Get a closed 2d curve boundary loop
71  Parameters:
72  Return:
73  Pointer to loop's 2d curve
74  */
75  const ON_Curve* Curve() const;
76 
77  /*
78  Description:
79  Specify the 2d loop curve in the hatch's plane coordinates
80  Parameters:
81  curve - [in] 2d input curve
82  Return:
83  true: success, false, curve couldn't be duplicated
84  Remarks:
85  The curve is copied
86  */
87  bool SetCurve( const ON_Curve& curve);
88 
89  /*
90  Description:
91  Get the type flag of the loop
92  Returns:
93  eLoopType::ltInner or eLoopType::ltOuter
94  */
95  eLoopType Type() const;
96 
97  /*
98  Description:
99  Specify the type flag of the loop
100  Parameters:
101  type - [in] ltInner or ltOuter
102  */
103  void SetType( eLoopType type);
105 protected:
106  friend class ON_Hatch;
107  eLoopType m_type; // loop type flag - inner or outer
108  ON_Curve* m_p2dCurve; // 2d closed curve bounding the hatch
109  // This is really a 3d curve with z coordinates = 0
110 };
111 
112 
113 /*
114  class ON_HatchLine
115  /////////////////////////////////////////////////////////////////
116  Represents one line of a hatch pattern
117  Similar to AutoCAD's .pat file definition
118  ON_HatchLine's are used by ON_HatchPattern
119  to specify the dashes and offset patterns of the lines.
120 
121  Each line has the following information:
122  Angle is the direction of the line CCW from the x axis
123  The first line origin is at base
124  Each line repetition is offset by offset from the previous line
125  offset.x is parallel to the line and
126  offset.y is perpendicular to the line
127  The base and offset values are rotated by the line's angle to
128  produce a location in the hatch pattern's coordinate system
129  There can be gaps and dashes specified for drawing the line
130 
131  If there are no dashes, the line is solid
132  Negative length dashes are gaps
133  Positive length dashes are drawn as line segments
134 */
135 
136 class ON_CLASS ON_HatchLine
137 {
138 public:
139  // Default constructor creates ON_HatchLine::SolidHorizontal
140  ON_HatchLine() = default;
141  ~ON_HatchLine() = default;
142  ON_HatchLine(const ON_HatchLine&) = default;
143  ON_HatchLine& operator=(const ON_HatchLine&) = default;
145  static const ON_HatchLine Unset; // angle = unset
146  static const ON_HatchLine SolidHorizontal; // angle = 0
147  static const ON_HatchLine SolidVertical; // angle = pi/2
148 
149  static int Compare(
150  const ON_HatchLine& a,
151  const ON_HatchLine& b
152  );
153 
154  ON_HatchLine(
155  double angle_in_radians,
156  ON_2dPoint base,
157  ON_2dVector offset,
158  const ON_SimpleArray<double>& dashes
159  );
160 
161  // constructs solid line
162  ON_HatchLine(
163  double angle_in_radians
164  );
165 
166  bool operator==( const ON_HatchLine&) const;
167  bool operator!=( const ON_HatchLine&) const;
168 
169  bool IsValid( ON_TextLog* text_log = nullptr ) const;
170  void Dump( ON_TextLog& ) const; // for debugging
171 
172 public:
173  bool Write( ON_BinaryArchive&) const; // serialize definition to binary archive
174  bool Read( ON_BinaryArchive&); // restore definition from binary archive
175 
176 private:
177  bool WriteV5(ON_BinaryArchive&) const; // serialize definition to binary archive
178  bool ReadV5(ON_BinaryArchive&); // restore definition from binary archive
179 
180 public:
181  /////////////////////////////////////////////////////////////////
182  //
183  // Interface
184  //
185 
186  /*
187  Description:
188  Get angle of the hatch line.
189  CCW from x-axis
190  Parameters:
191  Return:
192  The angle in radians
193  */
194  double AngleRadians() const;
195 
196  double AngleDegrees() const;
197 
198  /*
199  Description:
200  Set angle of the hatch line.
201  CCW from x-axis
202  Parameters:
203  angle - [in] angle in radians
204  Return:
205  */
206  void SetAngleRadians(
207  double angle_in_radians
208  );
209 
210  void SetAngleDegrees(
211  double angle_in_degrees
212  );
213 
214  /*
215  Description:
216  Get this line's 2d basepoint
217  Parameters:
218  Return:
219  the base point
220  */
221  ON_2dPoint Base() const;
222  /*
223  Description:
224  Set this line's 2d basepoint
225  Parameters:
226  base - [in] the basepoint
227  Return:
228  */
229  void SetBase( const ON_2dPoint& base);
230 
231  /*
232  Description:
233  Get this line's 2d offset for line repetitions
234  Offset().x is shift parallel to line
235  Offset().y is spacing perpendicular to line
236  Parameters:
237  Return:
238  the offset
239  */
240  ON_2dVector Offset() const;
241 
242  /*
243  Description:
244  Get this line's 2d offset for line repetitions
245  Offset().x is shift parallel to line
246  Offset().y is spacing perpendicular to line
247  Parameters:
248  offset - [in] the shift,spacing for repeated lines
249  Return:
250  */
251  void SetOffset( const ON_2dVector& offset);
252 
253  /*
254  Description:
255  Get the number of gaps + dashes in the line
256  Parameters:
257  Return:
258  nummber of dashes in the line
259  */
260  int DashCount() const;
261 
262  /*
263  Description:
264  Get the dash length at index
265  Parameters:
266  index - [in] the dash to get
267  Return:
268  the length of the dash ( gap if negative)
269  */
270  double Dash( int) const;
271 
272  /*
273  Description:
274  Add a dash to the pattern
275  Parameters:
276  dash - [in] length to append - < 0 for a gap
277  */
278  void AppendDash( double dash);
279 
280  /*
281  Description:
282  Specify a new dash array
283  Parameters:
284  dashes - [in] array of dash lengths
285  */
286  void SetDashes( const ON_SimpleArray<double>& dashes);
287 
288  const ON_SimpleArray<double>& Dashes() const;
289 
290  /*
291  Description:
292  Get the line's angle, base, offset and dashes
293  in one function call
294  Parameters:
295  angle_radians - [out] angle in radians CCW from x-axis
296  base - [out] origin of the master line
297  offset - [out] offset for line replications
298  dashes - [out] the dash array for the line
299  Return:
300  */
301  void GetLineData(
302  double& angle_radians,
303  ON_2dPoint& base,
304  ON_2dVector& offset,
305  ON_SimpleArray<double>& dashes) const;
306 
307  /*
308  Description:
309  Get the total length of a pattern repeat
310  Parameters:
311  Return:
312  Pattern length
313  */
314  double GetPatternLength() const;
315 
316 private:
317  double m_angle_radians = 0.0;
320  ON_SimpleArray< double> m_dashes;
321 };
322 
323 
324 
325 
326 #if defined(ON_DLL_TEMPLATE)
327 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_HatchLoop*>;
328 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_HatchLine>;
329 #endif
330 
331 
332 /*
333  class ON_HatchPattern
334  /////////////////////////////////////////////////////////////////
335  Fill definition for a hatch
336 
337  The hatch will be one of
338  ON_Hatch::ON_HatchPattern::HatchFillType::Lines - pat file style definition
339  ON_Hatch::ON_HatchPattern::HatchFillType::Gradient - uses a color function
340  ON_Hatch::ON_HatchPattern::HatchFillType::Solid - uses entity color
342 */
343 class ON_CLASS ON_HatchPattern : public ON_ModelComponent
344 {
345  ON_OBJECT_DECLARE( ON_HatchPattern);
347 public:
348  ON_HatchPattern() ON_NOEXCEPT;
349  ~ON_HatchPattern() = default;
351  ON_HatchPattern& operator=(const ON_HatchPattern&) = default;
352 
353 public:
354  static const ON_HatchPattern Unset; // index = ON_UNSET_INT_INDEX, id = nil
355  static const ON_HatchPattern Solid; // index = -1, id set, unique and persistent
356  static const ON_HatchPattern Hatch1; // index = -2, id set, unique and persistent
357  static const ON_HatchPattern Hatch2; // index = -3, id set, unique and persistent
358  static const ON_HatchPattern Hatch3; // index = -4, id set, unique and persistent
359  static const ON_HatchPattern HatchDash; // index = -5, id set, unique and persistent
360  static const ON_HatchPattern Grid; // index = -6, id set, unique and persistent
361  static const ON_HatchPattern Grid60; // index = -7, id set, unique and persistent
362  static const ON_HatchPattern Plus; // index = -8, id set, unique and persistent
363  static const ON_HatchPattern Squares; // index = -9, id set, unique and persistent
364 
365  // compare everything except Index() value.
366  static int Compare(
367  const ON_HatchPattern& a,
368  const ON_HatchPattern& b
369  );
370 
371  // Compare all settings (type, lines, ...) that effect the appearance.
372  // Ignore Index(), Id(), Name()
373  static int CompareAppearance(
374  const ON_HatchPattern& a,
375  const ON_HatchPattern& b
376  );
377 
378 public:
379  /*
380  Parameters:
381  model_component_reference - [in]
382  none_return_value - [in]
383  value to return if ON_Layer::Cast(model_component_ref.ModelComponent())
384  is nullptr
385  Returns:
386  If ON_Layer::Cast(model_component_ref.ModelComponent()) is not nullptr,
387  that pointer is returned. Otherwise, none_return_value is returned.
388  */
389  static const ON_HatchPattern* FromModelComponentRef(
390  const class ON_ModelComponentReference& model_component_reference,
391  const ON_HatchPattern* none_return_value
392  );
393 
394 public:
395 
396  enum class HatchFillType : unsigned int
397  {
398  Solid = 0, // uses entity color
399  Lines = 1, // pat file definition
400  Gradient = 2, // uses a fill color function
401  };
402 
403  static ON_HatchPattern::HatchFillType HatchFillTypeFromUnsigned(
404  unsigned hatch_fill_type_as_unsigned
405  );
406 
407 
408  /////////////////////////////////////////////////////////////////
409  // ON_Object overrides
410  bool IsValid( class ON_TextLog* text_log = nullptr ) const override;
411  void Dump( ON_TextLog& ) const override; // for debugging
412  bool Write( ON_BinaryArchive&) const override;
413  bool Read( ON_BinaryArchive&) override;
414 private:
415  bool WriteV5(ON_BinaryArchive&) const;
416  bool ReadV5(ON_BinaryArchive&);
417 public:
418 
419  //////////////////////////////////////////////////////////////////////
420  // Interface
421 
422  /*
423  Description:
424  Return the pattern's fill type
425  Parameters:
426  */
427  ON_HatchPattern::HatchFillType FillType() const;
428 
429  /*
430  Description:
431  Set the pattern's fill type
432  Parameters:
433  type - [in] the new filltype
434  */
435  void SetFillType(
437  );
438 
439  /*
440  Description:
441  Set the name of the pattern
442  Parameters:
443  pDescription - [in] the new description
444  Returns:
445  */
446  void SetDescription(
447  const wchar_t* pDescription
448  );
449 
450  /*
451  Description:
452  Get a short description of the pattern
453  Parameters:
454  string - [out] The string is returned here
455  */
456  const ON_wString& Description() const;
457 
458 
459  // Interface functions for line hatches
460  /////////////////////////////////////////////////////////////////
461  /*
462  Description:
463  Get the number of ON_HatchLines in the pattern
464  Parameters:
465  Return:
466  number of lines
467  */
468  int HatchLineCount() const;
469 
470  /*
471  Description:
472  Add an ON_HatchLine to the pattern
473  Parameters:
474  line - [in] the line to add
475  Return:
476  >= 0 index of the new line
477  -1 on failure
478  */
479  int AddHatchLine(
480  const ON_HatchLine& line
481  );
482 
483  /*
484  Description:
485  Get the ON_HatchLine at index
486  Parameters:
487  index - [in] Index of the line to get
488  Return:
489  the hatch line
490  nullptr if index is out of range
491  */
492  const ON_HatchLine* HatchLine(
493  int index
494  ) const;
495 
496  /*
497  Description:
498  Remove a hatch line from the pattern
499  Parameters:
500  index - [in] Index of the line to remove
501  Return:
502  true - success
503  false - index out of range
504  */
505  bool RemoveHatchLine(
506  int index
507  );
508 
509  /*
510  Description:
511  Remove all of the hatch line from the pattern
512  Parameters:
513 
514  Return:
515  true - success
516  false - index out of range
517  */
518  void RemoveAllHatchLines();
519 
520  /*
521  Description:
522  Set all of the hatch lines at once.
523  Existing hatchlines are deleted.
524  Parameters:
525  lines - [in] Array of lines to add. Lines are copied
526  Return:
527  number of lines added
528  */
529  int SetHatchLines(
530  const ON_ClassArray<ON_HatchLine>& lines
531  );
532 
533  int SetHatchLines(
534  size_t count,
535  const ON_HatchLine* lines
536  );
537 
538  const ON_ClassArray<ON_HatchLine>& HatchLines() const;
540 private:
542 
543  ON_wString m_description = ON_wString::EmptyString; // String description of the pattern
544 
545  // Represents a collection of ON_HatchLine's to make a complete pattern
546  // This is the definition of a hatch pattern.
547  // Simple solid line hatches with fixed angle and spacing are also
548  // represented with this type of hatch
549  ON_ClassArray<ON_HatchLine> m_lines; // used by line hatches
550 };
551 
552 #if defined(ON_DLL_TEMPLATE)
553 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_HatchPattern*>;
554 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<const ON_HatchPattern*>;
555 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_HatchPattern>;
556 #endif
557 
558 /*
559  class ON_Hatch
560  /////////////////////////////////////////////////////////////////
561  Represents a hatch in planar boundary loop or loops
562  This is a 2d entity with a plane defining a local coordinate system
563  The loops, patterns, angles, etc are all in this local coordinate system
564 
565  The ON_Hatch object manages the plane and loop array
566  Fill definitions are in the ON_HatchPattern or class derived from ON_HatchPattern
567  ON_Hatch has an index to get the pattern definition from the pattern table
568 
569 */
570 class ON_CLASS ON_Hatch : public ON_Geometry
571 {
572  ON_OBJECT_DECLARE( ON_Hatch);
573 
574 public:
575  // Default constructor
576  ON_Hatch() = default;
577  ~ON_Hatch();
578  ON_Hatch( const ON_Hatch&);
579  ON_Hatch& operator=(const ON_Hatch&);
580 
581  static ON_Hatch* HatchFromBrep(
582  ON_Hatch* use_this_hatch,
583  const ON_Brep* brep,
584  int face_index,
585  int pattern_index,
586  double pattern_rotation_radians,
587  double pattern_scale,
588  ON_3dPoint basepoint);
589 
590 private:
591  void Internal_Destroy();
592  void Internal_CopyFrom(const ON_Hatch& src);
593 public:
594 
595  virtual ON_Hatch* DuplicateHatch() const;
596 
597  // ON_Object overrides
598  /////////////////////////////////////////////////////////////////
599  bool IsValid( class ON_TextLog* text_log = nullptr ) const override;
600  void Dump( ON_TextLog& ) const override;
601  bool Write( ON_BinaryArchive&) const override;
602  bool Read( ON_BinaryArchive&) override;
603  ON::object_type ObjectType() const override;
604 
605  // ON_Geometry overrides
606  /////////////////////////////////////////////////////////////////
607  /*
608  Returns the geometric dimension of the object ( usually 3)
609  */
610  int Dimension() const override;
611 
612  // virtual ON_Geometry GetBBox override
613  bool GetBBox( double* boxmin, double* boxmax, bool bGrowBox = false ) const override;
614 
615  // virtual ON_Geometry GetTightBoundingBox override
616  bool GetTightBoundingBox( class ON_BoundingBox& tight_bbox, bool bGrowBox = false, const class ON_Xform* xform = nullptr ) const override;
617 
618  /*
619  Description:
620  Transform the object by a 4x4 xform matrix
621 
622  Parameters:
623  [in] xform - An ON_Xform with the transformation information
624  Returns:
625  true = Success
626  false = Failure
627  Remarks:
628  The object has been transformed when the function returns.
629  */
630  bool Transform( const ON_Xform&) override;
631 
632  /*
633  Description:
634  If possible, BrepForm() creates a brep form of the
635  ON_Geometry.
636  Parameters:
637  brep - [in] if not nullptr, brep is used to store the brep
638  form of the geometry.
639  Result:
640  Returns a pointer to on ON_Brep or nullptr. If the brep
641  parameter is not nullptr, then brep is returned if the
642  geometry has a brep form and nullptr is returned if the
643  geometry does not have a brep form.
644  Remarks:
645  The caller is responsible for managing the brep memory.
646  See Also
647  ON_Geometry::HasBrepForm
648  */
649  class ON_Brep* BrepForm(
650  class ON_Brep* brep = nullptr
651  ) const override;
652 
653 
654 
655  // Interface
656  /////////////////////////////////////////////////////////////////
657 
658  /*
659  Description:
660  Create a hatch from input geometry and parameters
661  Parameters:
662  plane [I] - ON_Plane to make the hatch on
663  loops [I] - Array of boundary loops with the outer one first
664  pattern_index [I] - Index into the hatch table
665  pattern_rotation [I] - ccw in radians about plane origin
666  pattern_scale [I] - Scale factor for pattern definition
667  Returns:
668  true = success, false = failure
669  */
670  bool Create( const ON_Plane& plane,
671  const ON_SimpleArray<const ON_Curve*> loops,
672  int pattern_index,
673  double pattern_rotation,
674  double pattern_scale);
675 
676  /*
677  Description:
678  Get the plane defining the hatch's coordinate system
679  Parameters:
680  Returns:
681  the plane
682  */
683  const ON_Plane& Plane() const;
684 
685  /*
686  Description:
687  Set the plane defining the hatch's coordinate system
688  Parameters:
689  plane - [in] the plane to set
690  Returns:
691  */
692  void SetPlane( const ON_Plane& plane);
693 
694  /*
695  Description:
696  Gets the rotation applied to the hatch pattern
697  when it is mapped to the hatch's plane
698  Returns:
699  The rotation in radians
700  Remarks:
701  The pattern is rotated counter-clockwise around
702  the hatch's plane origin by this value
703  */
704  double PatternRotation() const;
705 
706 /*
707  Description:
708  Sets the rotation applied to the hatch pattern
709  when it is mapped to the hatch's plane
710  Parameters:
711  rotation - [in] The rotation in radians
712  Remarks:
713  The pattern is rotated counter-clockwise around
714  the hatch's plane origin by this value
715  */
716  void SetPatternRotation( double rotation);
717 
718  /*
719  Description:
720  Gets the scale applied to the hatch pattern
721  when it is mapped to the hatch's plane
722  Returns:
723  The scale
724  Remarks:
725  The pattern is scaled around
726  the hatch's plane origin by this value
727  */
728  double PatternScale() const;
729 
730 /*
731  Description:
732  Sets the scale applied to the hatch pattern
733  when it is mapped to the hatch's plane
734  Parameters:
735  scale - [in] The scale
736  Remarks:
737  The pattern is scaled around
738  the hatch's plane origin by this value
739  */
740  void SetPatternScale( double scale);
741 
742  /*
743  Description:
744  Get the number of loops used by this hatch
745  Parameters:
746  Returns:
747  the number of loops
748  */
749  int LoopCount() const;
750 
751  /*
752  Description:
753  Add a loop to the hatch
754  Parameters:
755  loop - [in] the loop to add. Memory management for the loop is managed
756  by this class.
757  Returns:
758  */
759  void AddLoop( ON_HatchLoop* loop);
760 
761  /*
762  Description:
763  Insert a loop to the hatch at the specified index
764  Parameters:
765  index - [in] zero based index of the position where insert the loop to.
766  loop - [in] the loop to insert. Memory management for the loop is managed
767  by this class on success.
768  Returns:
769  true if success
770  false if index is lower than 0 or greater than current loop count.
771  */
772  bool InsertLoop( int index,
773  ON_HatchLoop* loop);
774 
775  /*
776  Description:
777  Remove a loop in the hatch
778  Parameters:
779  loop - [in] zero based index of the loop to remove.
780  Returns:
781  true if success
782  */
783  bool RemoveLoop( int index);
784 
785  /*
786  Description:
787  Get the loop at index
788  Parameters:
789  index - [in] which loop to get
790  Returns:
791  pointer to loop at index
792  nullptr if index is out of range
793  */
794  const ON_HatchLoop* Loop( int index) const;
795 
796  /*
797  Description:
798  Get the 3d curve corresponding to loop[index]
799  Parameters:
800  index - [in] which loop to get
801  Returns:
802  pointer to 3d curve of loop at index
803  nullptr if index is out of range or curve can't be made
804  Caller deletes the returned curve
805  */
806  ON_Curve* LoopCurve3d( int index) const;
807 
808  /*
809  Description:
810  Get the index of the hatch's pattern
811  Parameters:
812  Returns:
813  index of the pattern
814  */
815  int PatternIndex() const;
816 
817 /*
818  Description:
819  Set the index of the hatch's pattern
820  Parameters:
821  index - [in] pattern index to set
822  Returns:
823  */
824  void SetPatternIndex( int index);
825 
826  // Basepoint functions added March 23, 2008 -LW
827  /*
828  Description:
829  Set 2d Base point for hatch pattern alignment.
830  Parameters:
831  basepoint - 2d point in hatch's ECS
832  */
833  void SetBasePoint(ON_2dPoint basepoint);
834 
835  /*
836  Description:
837  Set 3d Base point for hatch pattern alignment.
838  Parameters:
839  point - 3d WCS point
840  Remarks:
841  Projects point to hatch's plane and sets 2d point
842  */
843  void SetBasePoint(ON_3dPoint point);
844 
845  /*
846  Description:
847  Return 3d WCS point that lies on hatch's plane used for pattern origin.
848  */
849  ON_3dPoint BasePoint() const;
850 
851  /*
852  Description:
853  Return 2d ECS point used for pattern origin.
854  */
855  ON_2dPoint BasePoint2d() const;
856 
857  /*
858  Function added June 12 2008 LW
859  Description:
860  Remove all of the loops on the hatch and add the curves in 'loops' as new loops
861  Parameters:
862  loops - [in] An array of pointers to 2d or 3d curves
863  If the curves are 2d, add them to the hatch directly
864  If they are 3d, project them to the hatch's plane first
865  Returns:
866  true - success
867  false - no loops in input array or an error adding them
868  */
869  bool ReplaceLoops(ON_SimpleArray<const ON_Curve*>& loops);
870 
871 private:
872  ON_Plane m_plane;
873  double m_pattern_scale = 1.0;
874  double m_pattern_rotation = 0.0;
875  ON_2dPoint m_basepoint = ON_2dPoint::Origin;
877  int m_pattern_index = -1;
878 };
879 
880 #endif
Definition: opennurbs_hatch.h:327
static const ON_2dPoint Origin
Definition: opennurbs_point.h:290
The ON_ModelComponent class is a base class for all components in a model and manages the index...
Definition: opennurbs_model_component.h:24
Definition: opennurbs_hatch.h:25
HatchFillType
Definition: opennurbs_hatch.h:378
ON_Curve is a pure virtual class for curve objects
Definition: opennurbs_curve.h:93
ON_Object array is used to store lists of classes that are derived from ON_Object. It differs from ON_ClassArray in that the virtual ON_Object::MemoryRelocate function is called when growing the dynamic array requires changing the location of the memory buffer used to store the elements in the array.
Definition: opennurbs_array.h:725
Definition: opennurbs_string.h:2020
Definition: opennurbs_hatch.h:134
Base class for all geometry classes that must provide runtime class id. Provides interface for common...
Definition: opennurbs_geometry.h:37
Definition: opennurbs_point.h:277
eLoopType
Definition: opennurbs_hatch.h:47
Definition: opennurbs_bounding_box.h:25
Definition: opennurbs_xform.h:28
Definition: opennurbs_hatch.h:539
Definition: opennurbs_brep.h:1472
Definition: opennurbs_textlog.h:20
Definition: opennurbs_archive.h:1783
static const ON_wString EmptyString
Definition: opennurbs_string.h:2026
Definition: opennurbs_model_component.h:1622
Definition: opennurbs_point.h:460
Definition: opennurbs_plane.h:20
static const ON_2dVector ZeroVector
Definition: opennurbs_point.h:852
Definition: opennurbs_point.h:839