Created
August 21, 2015 17:51
-
-
Save sbaer/b154cd39b5445047ea2f to your computer and use it in GitHub Desktop.
SubDVertex ideas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct SubDVertex | |
{ | |
SubD m_parent; | |
IntPtr m_ptr_vertex; // ON_SubDVertex* vertex | |
uint m_parent_sn; | |
ComponentIndex m_component_index; | |
internal SubDVertex(SubD subd, IntPtr ptr_vertex, ComponentIndex ci, Point3d location) | |
{ | |
m_parent = subd; | |
m_ptr_vertex = current; | |
m_component_index = ci; | |
m_parent_sn = m_parent.RuntimeSerialNumber; | |
Location = location; | |
} | |
public SubDVertex Next() | |
{ | |
if( m_ptr_next == IntPtr.Zero || m_ptr_vertex == IntPtr.Zero || m_parent==null ) | |
return SubDVertex.Empty; | |
if( m_parent_sn != m_parent.RuntimeSerialNumber ) | |
{ | |
// fix up vertex pointer based on ComponentIndex | |
} | |
ComponentIndex next_ci = new ComponentIndex(); | |
Point3d location = new Point3d(); | |
IntPtr next = UnsafeNativeMethods.ON_SubDVertex_GetNext(m_ptr_vertex, ref next_ci, ref location); | |
if( next == IntPtr.Zero ) | |
return SubDVertexNode.Empty; | |
return new SubDVertex(m_parent, next, next_ci); | |
} | |
public Point3d Location | |
{ | |
get; private set; // note that set is not public | |
} | |
} | |
class SubDVertexList | |
{ | |
SubD m_parent; | |
public SubDVertex UpdateVertex( SubDVertex vertex, Point3d newLocation ) | |
{ | |
// perform some validaton, make m_parent non-const, update location | |
// return SubDVertex with new location data | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment