def draw( self ) : SurfaceC0.draw( self ) glPushAttrib(GL_ALL_ATTRIB_BITS) glBegin(GL_LINES) glColor3f(1,0,0) glVertex3f(*self.pts[ 1]) glVertex3f(*self.pts[ 6]) glVertex3f(*self.pts[ 4]) glVertex3f(*self.pts[ 5]) glVertex3f(*self.pts[ 2]) glVertex3f(*self.pts[ 9]) glVertex3f(*self.pts[ 7]) glVertex3f(*self.pts[10]) glVertex3f(*self.pts[ 8]) glVertex3f(*self.pts[17]) glVertex3f(*self.pts[11]) glVertex3f(*self.pts[18]) glVertex3f(*self.pts[13]) glVertex3f(*self.pts[16]) glVertex3f(*self.pts[14]) glVertex3f(*self.pts[19]) glVertex3f(*self.pts[ 3]) glVertex3f(*self.pts[ 7]) glVertex3f(*self.pts[12]) glVertex3f(*self.pts[13]) glVertex3f(*self.pts[13]) glVertex3f(*self.pts[16]) glVertex3f(*self.pts[ 7]) glVertex3f(*self.pts[10]) glEnd() glPopAttrib()
def __init__(self, data, pts_vis=True, curve_vis=True, polygon_vis=False, pts=None): SurfaceC0.__init__(self, data, pts_vis, curve_vis, polygon_vis, pts)
def draw(self): SurfaceC0.draw(self) glPushAttrib(GL_ALL_ATTRIB_BITS) glBegin(GL_LINES) glColor3f(1, 0, 0) glVertex3f(*self.pts[1]) glVertex3f(*self.pts[6]) glVertex3f(*self.pts[4]) glVertex3f(*self.pts[5]) glVertex3f(*self.pts[2]) glVertex3f(*self.pts[9]) glVertex3f(*self.pts[7]) glVertex3f(*self.pts[10]) glVertex3f(*self.pts[8]) glVertex3f(*self.pts[17]) glVertex3f(*self.pts[11]) glVertex3f(*self.pts[18]) glVertex3f(*self.pts[13]) glVertex3f(*self.pts[16]) glVertex3f(*self.pts[14]) glVertex3f(*self.pts[19]) glVertex3f(*self.pts[3]) glVertex3f(*self.pts[7]) glVertex3f(*self.pts[12]) glVertex3f(*self.pts[13]) glVertex3f(*self.pts[13]) glVertex3f(*self.pts[16]) glVertex3f(*self.pts[7]) glVertex3f(*self.pts[10]) glEnd() glPopAttrib()
def new(self, pos, which_cur, pre_data=None, post_data=None): if which_cur == Curves.BEZIER_C0: self.selected = BezierC0(self.bz_points, self.bz_curves, self.bz_polygons) elif which_cur == Curves.BEZIER_C2: self.selected = BezierC2(self.bz_points, self.bz_curves, self.bz_polygons, self.bs_points, self.bs_curves, self.bs_polygons) elif which_cur == Curves.INTERPOLATION: self.selected = Interpolation() elif which_cur == Curves.SURFACE_C0: self.selected = SurfaceC0(pre_data, self.bz_points, self.bz_curves, self.bz_polygons) elif which_cur == Curves.SURFACE_C2: self.selected = SurfaceC2(pre_data, self.bz_points, self.bz_curves, self.bz_polygons) elif which_cur == Curves.SURFACE_PIPE: self.selected = Pipe(pre_data, self.bz_points, self.bz_curves, self.bz_polygons) elif which_cur == Curves.SURFACE_GREGORY: self.selected = GregoryGap(pre_data, self.bz_points, self.bz_curves, self.bz_polygons) self.selected.new(pos, post_data) self.add_child(self.selected) self.selected.set_screen_size(self.w, self.h)
def make_bezier_pts( self , a , b ) : dx = (b - a)/3.0 dy = np.empty(3,np.float32) dy[0] =-dx[1] dy[1] = dx[0] dy[2] = dx[2] beg = len(self.pts) for y in range(4) : for x in range(4) : if y == 0 and x == 0 : pt = a elif y == 0 and x == 3 : pt = b else : pt = a + dx * x + dy * y self.pts.append( pt ) self.surfs.append( SurfaceC0( ((1,1),self.dens) , pts = self.pts[beg:beg+16] ) ) self.base_surfs = len(self.surfs) self._subsurfs = np.zeros( (self.base_surfs,16,3) , np.float32 )
def __init__( self , data , pts_vis = True , curve_vis = True , polygon_vis = False , pts = None ) : SurfaceC0.__init__(self,data,pts_vis,curve_vis,polygon_vis,pts)