def create_cp(): # begin from oricreate.api import CreasePatternState import numpy as np x = np.array([[0, 0, 0], [1, 0, 0], [1, 1, 0], [2, 1, 0]], dtype='float_') L = np.array([[0, 1], [1, 2], [2, 0], [1, 3], [2, 3]], dtype='int_') F = np.array([ [0, 1, 2], [1, 3, 2], ], dtype='int_') cp = CreasePatternState(X=x, L=L, F=F) print('Initial configuration') print('Orthonormal base vectors of a first edge\n', cp.F_L_bases[:, 0, :, :]) return cp cp.u[1, 2] = 1.0 cp.u[2, 2] = 1.0 cp.u = cp.u print('Displaced configuration') print('Orthonormal base vectors of a first edge r\n', cp.F_L_bases[:, 0, :, :]) # end return cp
def create_cp(): # begin from oricreate.api import CreasePatternState import numpy as np x = np.array([[0, 0, 0], [1, 0, 0], [1, 1, 0], [2, 1, 0] ], dtype='float_') L = np.array([[0, 1], [1, 2], [2, 0], [1, 3], [2, 3]], dtype='int_') F = np.array([[0, 1, 2], [1, 3, 2], ], dtype='int_') cp = CreasePatternState(X=x, L=L, F=F) print 'Initial configuration' print 'Orthonormal base vectors of a first edge\n', cp.F_L_bases[:, 0, :, :] return cp cp.u[1, 2] = 1.0 cp.u[2, 2] = 1.0 cp.u = cp.u print 'Displaced configuration' print 'Orthonormal base vectors of a first edge r\n', cp.F_L_bases[:, 0, :, :] # end return cp
print('im_centers', efttitle_viz3d.im_centers) print('bases', efttitle_viz3d.bases) print('rotated bases', efttitle_viz3d.rotated_bases) print('glb_centers', efttitle_viz3d.glb_centers) print('glb_angles', efttitle_viz3d.glb_euler_angles) ftv = FTV() ftv.add(cp.viz3d['cp']) ftv.add(efttitle_viz3d) ftv.add(eftlogo_bases) m = ftv.mlab fig = m.gcf() m.figure(figure=fig, bgcolor=(1, 1, 1)) ftv.plot() cp.u[1, 2] = 1.0 cp.u = np.copy(cp.u) cp.viz3d_notify_change() efttitle_viz3d.vis3d_changed = True print('glb_centers', efttitle_viz3d.glb_centers) print('glb_angles', efttitle_viz3d.glb_euler_angles) ftv.update(force=True) print('plot') ftv.configure_traits() print('show')
def _get_x(self): return self.x_t[self.time_step] u = Property '''Current displacement . ''' def _get_u(self): print('TIME STEP', self.time_step) return self.u_t[self.time_step] if __name__ == '__main__': # trivial example with a single triangle positioned from oricreate.api import CreasePatternState cp = CreasePatternState(x_0=[[0, 0, 0], [1, 0, 0], [1, 1, 0], [0.667, 0.333, 0], [0.1, 0.05, 0]], L=[[0, 1], [1, 2], [2, 0]], F=[[0, 1, 2]]) print('vectors\n', cp.L_vectors) print('lengths\n', cp.L_lengths) cp.u = np.zeros_like(cp.x_0) cp.u[:, 2] = 1.0 print('x\n', cp.x)