def main(): mshelm = dfm2.MeshElem("../test_inputs/bunny_2k.ply") mshelm.color_face = [1, 1, 1, 1] aabb = dfm2.AABB3(mshelm.minmax_xyz()) axis = dfm2.AxisXYZ(100.0) axis.line_width = 3 sampler = dfm2.GPUSampler() sampler.init(size_res_width=256, size_res_height=256, is_color=True, is_depth=True) sampler.set_coordinate(len_grid=0.2, depth_max=100.0, org=[0, -50, 0], dir_prj=[0, -1.0, 0], dir_width=[1, 0, 0]) sampler.color = [0, 0, 1, 1] sampler.len_axis = 10 sampler.bgcolor = [1, 1, 0, 1] buffer = dfm2.DepthColorBuffer(win_size=[512, 512], is_color=True, is_depth=True) dfm2.take_depth_shot(mshelm.draw, sampler, buffer) buffer.close() # np_depth = numpy.array(dfm2.depth_buffer(sampler),copy=True) # print(np_depth.shape) # numpy.savetxt("hoge.txt",np_depth) dfm2.winDraw3d([mshelm, aabb, sampler, axis])
def main(): A0 = numpy.zeros((128, 128)) for ix in range(A0.shape[0]): for iy in range(A0.shape[1]): A0[iy, ix] = 10 * math.sin(ix * 0.1) * math.cos(iy * 0.3) hm0 = dfm2.hight_map(A0) print(hm0.nDim, hm0.elemType) axis = dfm2.AxisXYZ() dfm2.winDraw3d([hm0, axis], (400, 400))
def main(): global mshelm voxelgrid = dfm2.VoxelGrid() voxelgrid.add(0, 0, 0) voxelgrid.add(1, 0, 0) voxelgrid.add(0, 1, 0) mshelm = dfm2.meshQuad3d_voxelGrid(voxelgrid) mshelm = mshelm.subdiv() mshelm = mshelm.subdiv() mshelm = mshelm.subdiv() axis = dfm2.AxisXYZ() dfm2.winDraw3d([mshelm, axis], (400, 400))
from OpenGL.GL import * import sys sys.path.append("../module_py") import dfm2 mshelm = dfm2.MeshElem("../test_inputs/bunny_2k.ply"); aabb = dfm2.AABB3( mshelm.minmax_xyz() ) dfm2.winDraw3d([mshelm,aabb])
from OpenGL.GL import * import sys sys.path.append("../module_py") import dfm2 aXYVertexOuterLoop = [0, 0, 1, 0, 1, 1, 0, 1] output = dfm2.triangulation(aXYVertexOuterLoop, edge_length=0.02) mshelm = output.meshElem dfm2.winDraw3d([mshelm])
from OpenGL.GL import * import sys sys.path.append("../module_py") import dfm2 cad = dfm2.Cad2D() cad.add_square() dfm2.winDraw3d([cad])
from OpenGL.GL import * import sys sys.path.append("../module_py") import dfm2 mshelm = dfm2.MeshElem("../test_inputs/bunny_2k.ply"); mshelm.scaleXYZ(0.03) dfm2.winDraw3d([mshelm],winsize=(400,300))