opennurbs_polyedgecurve.h
Go to the documentation of this file.
00001 /* $NoKeywords: $ */
00002 /*
00003 //
00004 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
00005 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
00006 // McNeel & Associates.
00007 //
00008 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
00009 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
00010 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
00011 //                              
00012 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
00013 //
00015 */
00016 
00017 #if !defined(ON_POLYEDGECURVE_INC_)
00018 #define ON_POLYEDGECURVE_INC_
00019 
00020 class ON_PolyEdgeSegment;
00021 
00022 class ON_CLASS ON_PolyEdgeCurve : public ON_PolyCurve
00023 {
00024   ON_OBJECT_DECLARE(ON_PolyEdgeCurve);
00025 
00026 public:
00027   ON_PolyEdgeCurve();
00028   ~ON_PolyEdgeCurve();
00029   // default copy constructor and operator= are fine.
00030 
00031   // virtual ON_Object::DestroyRuntimeCache override
00032   void DestroyRuntimeCache( bool bDelete = true );
00033 
00034   // virtual ON_Curve::IsClosed override
00035   ON_BOOL32 IsClosed() const;
00036 
00037   // virtual ON_Curve::DuplicateCurve override
00038   ON_Curve* DuplicateCurve() const;
00039 
00040   /*
00041   Description:
00042     Create a one segment ON_PolyEdgeCurve curve that uses a 
00043     single edge.
00044   */
00045   bool Create(
00046            const ON_BrepTrim* trim,
00047            const ON_UUID& object_id
00048            );
00049 
00050   /*
00051   Description:
00052     Create a one segment ON_PolyEdgeCurve curve that uses a 
00053     single curve.
00054   */
00055   bool Create(
00056            const ON_Curve* curve,
00057            const ON_UUID& object_id
00058            );
00059 
00060   int SegmentCount() const;
00061 
00062   ON_PolyEdgeSegment* SegmentCurve(
00063     int segment_index
00064     ) const;
00065 
00066   ON_PolyEdgeSegment* operator[](int) const;
00067 
00068   ON_BOOL32 Prepend( ON_PolyEdgeSegment* new_segment ); // Prepend curve.
00069   ON_BOOL32 Append( ON_PolyEdgeSegment* new_segment );  // Append curve.
00070   ON_BOOL32 Insert( 
00071            int segment_index,
00072            ON_PolyEdgeSegment* new_segment
00073            );
00074 
00075   // if the segment is an edge, the following
00076   // return non-NULL pointers.
00077   const ON_BrepEdge* EdgeAt(double t) const;
00078   const ON_BrepTrim* TrimAt(double t) const;
00079   const ON_Brep*     BrepAt(double t) const;
00080   const ON_BrepFace* FaceAt(double t) const;
00081   const ON_Surface*  SurfaceAt(double t) const;
00082   ON_Surface::ISO    IsoType( double t) const;
00083 
00084   double EdgeParameter(double t) const;
00085 
00086   // Test if there are any surface edges in the polyedge
00087   bool ContainsAnyEdges() const;
00088   // Test if all segments of the polyedge are surface edges
00089   bool ContainsAllEdges() const;
00090   
00091   /*
00092   Description:
00093     See if this polyedge has an edge as one of its segments
00094   Parameters:
00095     edge - [in] the edge to look for
00096   Returns:
00097      -1: edge is not in the polyedge
00098     >=0: index of first segment that uses the edge
00099   */
00100   int FindEdge( const ON_BrepEdge* edge) const;
00101 
00102   /*
00103   Description:
00104     See if this polyedge has a trim as one of its segments
00105   Parameters:
00106     trim - [in] the trim to look for
00107   Returns:
00108      -1: trim is not in the polyedge
00109     >=0: index of first segment that uses the trim
00110   */
00111   int FindTrim( const ON_BrepTrim* trim) const;
00112 
00113   /*
00114   Description:
00115     See if this polyedge has a wire curve as one of its segments
00116   Parameters:
00117     curve - [in] the curve to look for
00118   Returns:
00119      -1: trim is not in the polyedge
00120     >=0: index of first segment that uses the curve
00121   */
00122   int FindCurve( const ON_Curve* curve) const;
00123 
00124 
00125   // OBSOLETE and unreliable.  Use FindCurve, FindEdge, or FindTrim
00126   //bool Contains( const ON_Curve* curve) const;
00127 
00128   // virtual ON_Curve overrides do nothing
00129   // to prevent changing edge
00130   ON_BOOL32 SetStartPoint(ON_3dPoint start_point);
00131   ON_BOOL32 SetEndPoint(ON_3dPoint end_point);
00132   ON_BOOL32 ChangeClosedCurveSeam( double t );
00133   ON_BOOL32 PrependAndMatch(ON_Curve*);
00134   ON_BOOL32 AppendAndMatch(ON_Curve*);
00135 
00136   // 7-1-03 lw added override to unset cached closed flag
00137   // when a segment is removed
00138   ON_BOOL32 Remove(); // remove last
00139   ON_BOOL32 Remove( int index);
00140 };
00141 
00142 class ON_CLASS ON_PolyEdgeSegment : public ON_CurveProxy
00143 {
00144   ON_OBJECT_DECLARE(ON_PolyEdgeSegment);
00145 public:
00146   // construction
00147 
00148   ON_PolyEdgeSegment();
00149   ~ON_PolyEdgeSegment();
00150   // default copy constructor and operator= are fine.
00151 
00152   // virtual ON_Object::DestroyRuntimeCache override
00153   void DestroyRuntimeCache( bool bDelete = true );
00154 
00155   ON_BOOL32 Write( ON_BinaryArchive& ) const;
00156 
00157   ON_BOOL32 Read( ON_BinaryArchive& );
00158 
00159   // virtual ON_Curve::IsClosed override
00160   ON_BOOL32 IsClosed() const;
00161 
00162 
00163   // virtual ON_Curve::DuplicateCurve override
00164   ON_Curve* DuplicateCurve() const;
00165 
00166   /*
00167   Description:
00168     Creates a polyedge segment that uses the entire edge
00169     and has the same domain as the edge.
00170   Parameters:
00171     trim - [in] 
00172   Returns:
00173     true if successful (edge was valid and trim_index was valid)
00174   Remarks:
00175     Use ON_Curve::SetDomain, ON_Curve::Trim, ON_Curve::Reverse,
00176     etc., to tweak the domain, support, direction etc.
00177   */
00178   bool Create( 
00179           const ON_BrepTrim* trim,
00180           const ON_UUID& object_id
00181           );
00182 
00183   /*
00184   Description:
00185     Creates a polyedge segment that uses the entire curve
00186     and has the same domain as the curve.
00187   Parameters:
00188     curve - [in] 
00189   Remarks:
00190     Use ON_Curve::SetDomain, ON_Curve::Trim, ON_Curve::Reverse,
00191     etc., to tweak the domain, support, direction etc.
00192   */
00193   bool Create( 
00194           const ON_Curve* curve,
00195           const ON_UUID& object_id
00196           );
00197 
00198   const ON_BrepEdge* Edge() const;
00199   const ON_BrepTrim* Trim() const;
00200   const ON_Brep*     Brep() const;
00201   const ON_BrepFace* Face() const;
00202   const ON_Surface*  Surface() const;
00203   ON_Surface::ISO    IsoType() const;
00204 
00205   double EdgeParameter(double t) const;
00206 
00207   /*
00208   Returns:
00209     True if this segment has an ON_BrepEdge and the direction of
00210     the ON_BrepEdge is the reverse of the direction of the segment.
00211   */
00212   bool ReversedEdgeDir() const;
00213 
00214   /*
00215   Returns:
00216     True if this segment has an ON_BrepTrim and the direction of
00217     the ON_BrepTrime is the reverse of the direction of the segment.
00218   */
00219   bool ReversedTrimDir() const;
00220 
00221   /*
00222   Returns:
00223     subdomain of the edge that this segment uses.  This can
00224     be different than the domain returned by this->Domain().
00225   */
00226   ON_Interval EdgeDomain() const;
00227 
00228   /*
00229   Returns:
00230     subdomain of the trim that this segment uses.  This can
00231     be different than the domain returned by this->Domain().
00232   */
00233   ON_Interval TrimDomain() const;
00234 
00235   // m_object_id = id of a brep or curve object in Rhino
00236   ON_UUID m_object_id; 
00237   // When the Rhino object is a brep, m_component_index
00238   // refers to either an edge or a trim.
00239   ON_COMPONENT_INDEX m_component_index;
00240   // corresponding domain of the edge - see note below
00241   ON_Interval m_edge_domain;  
00242   // corresponding domain of the trim - see note below
00243   ON_Interval m_trim_domain;   
00244 
00245 
00246   // When m_component_index refers to an ON_BrepTrim, there
00247   // are four domains and 4 classes derived from ON_Curve
00248   // that play a role in the polyedge segment.  It is possible
00249   // for all 4 of these domains to be different.
00250   //
00251   // "this" ON_PolyEdgeSegment is an ON_ProxyCurve.  The
00252   // evaluation domain of "this" is 
00253   //   = this->Domain()
00254   //   = ON_ProxyCurve::m_this_domain
00255   //
00256   // ON_ProxyCurve::m_real_curve points to the curve in the
00257   // c3 = ON_Brep::m_C3[edge.m_c3i].  "this" is a proxy for some 
00258   // sub-interval of c3.
00259   //   = this->ProxyCurveDomain()
00260   //   = ON_ProxyCurve::m_real_curve_domain
00261   //
00262   // The edge, an ON_BrepEdge, is also a proxy based on c3,
00263   // and the edge's evaluation domain is edge.m_this_domain.  
00264   // ON_PolyEdgeSegment::m_edge_domain records the increasing
00265   // subinterval of edge.m_this_domain that corresponds
00266   // to the portion of c3 "this" is using.
00267   // 
00268   // The trim, an ON_BrepTrim, is a proxy based on a curve
00269   // in ON_Brep::m_C2[].  Some portion of the trim corresponds
00270   // to the portion of the edge we are using.  m_trim_domain
00271   // is an increasing, possible subinterval, of the trim's domain
00272   // ON_BrepTrim::m_this_domain.
00273 
00274   // Runtime helpers
00275   const void* m_parent_object; // CRhinoBrepObject or CRhinoCurveObject
00276   const ON_Brep* m_brep;
00277   const ON_BrepTrim* m_trim;  // 2d trim in m_brep
00278   const ON_BrepEdge* m_edge;  // 3d edge in m_brep
00279   const ON_BrepFace* m_face;
00280   const ON_Surface* m_surface;
00281 
00282 private:
00283   friend class ON_PolyEdgeCurve;
00284   void ClearEvalCacheHelper();
00285 
00286   // parameter evaluation cache
00287   double m_t;
00288   double m_edge_t;
00289   double m_trim_t;
00290   double m_srf_uv[2];
00291   int m_trim_hint;
00292   int m_edge_hint;
00293 
00294   // surface evaluation cache
00295   int m_evsrf_hint[2];
00296   double m_evsrf_uv[2];
00297   ON_3dPoint m_evsrf_pt;
00298   ON_3dVector m_evsrf_du;
00299   ON_3dVector m_evsrf_dv;
00300   ON_3dVector m_evsrf_duu;
00301   ON_3dVector m_evsrf_duv;
00302   ON_3dVector m_evsrf_dvv;
00303   ON_3dVector m_evsrf_tan;
00304 
00305   void Init();
00306 };
00307 
00308 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:27:03