예제 #1
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("NurbsCurve",
                                         "NurbsEditCurveKnotVector")

selection = k3d.mesh_selection.deselect_all()
component_selection = k3d.mesh_selection.component(0, 1,
                                                   k3d.selection.type.UNIFORM,
                                                   0, 1000, 1)
selection.add_component(component_selection)

setup.modifier.mesh_selection = selection
knot_vector = [0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 2.0]

setup.modifier.knot_vector = knot_vector

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.NurbsEditKnotVector", 1)
예제 #2
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "MakeBilinearPatches")

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.MakeBilinearPatches", 1)
예제 #3
0
#python

import k3d
import testing

document = k3d.new_document()

source1 = document.new_node("BlobbyEllipsoid")
source1.color = k3d.color(1, 0, 0)

source2 = document.new_node("BlobbySegment")
source2.color = k3d.color(1, 1, 0)

modifier = document.new_node("BlobbyDivide")

document.set_dependency(modifier.get_property("input_a"),
                        source1.get_property("output_mesh"))
document.set_dependency(modifier.get_property("input_b"),
                        source2.get_property("output_mesh"))

testing.mesh_comparison_to_reference(document,
                                     modifier.get_property("output_mesh"),
                                     "mesh.modifier.BlobbyDivide", 5)
예제 #4
0
#python

import testing

setup = testing.setup_mesh_source_test("PolyCube")

testing.mesh_comparison_to_reference(setup.document, setup.source.get_property("output_mesh"), "mesh.source.PolyCube", 1)

예제 #5
0
#python

import testing

setup = testing.setup_mesh_reader_test("OBJMeshReader",
                                       "mesh.source.OBJMeshReader.nurbs.obj")
testing.mesh_comparison_to_reference(setup.document,
                                     setup.reader.get_property("output_mesh"),
                                     "mesh.source.OBJMeshReader.nurbs", 1)
예제 #6
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("NurbsGrid","NurbsPatchInsertKnot")

setup.modifier.mesh_selection = k3d.mesh_selection.select_all()
setup.modifier.u_value = 0.735
setup.modifier.multiplicity = 2
setup.modifier.insert_to_v = False

testing.mesh_comparison_to_reference(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.NurbsPatchInsertKnot", 32)

예제 #7
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "LinearPointNoise")

selection = k3d.mesh_selection.deselect_all()
selection.points = k3d.mesh_selection.component_select_all()

setup.modifier.mesh_selection = selection
setup.modifier.amplitude_x = 2
setup.modifier.amplitude_y = 2
setup.modifier.amplitude_z = 2

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.LinearPointNoise", 16)
예제 #8
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "TriangulateFaces")
setup.source.rows = 1
setup.source.columns = 1

mesh_selection = k3d.mesh_selection.select_all()
setup.modifier.mesh_selection = mesh_selection

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.TriangulateFaces.PolyGrid", 0)
예제 #9
0
import k3d
import testing

document = k3d.new_document()

source1 = document.new_node("PolyCone")
source2 = document.new_node("PolySphere")
source3 = document.new_node("PolyCube")
modifier = document.new_node("MorphPoints")

modifier.create_property("k3d::mesh*", "input1", "input1", "input1")
modifier.create_property("k3d::mesh*", "input2", "input2", "input2")
modifier.create_property("k3d::double_t", "amount1", "amount1", "amount1")
modifier.create_property("k3d::double_t", "amount2", "amount2", "amount2")

document.set_dependency(modifier.get_property("input_mesh"), source1.get_property("output_mesh"))
document.set_dependency(modifier.get_property("input1"), source2.get_property("output_mesh"))
document.set_dependency(modifier.get_property("input2"), source3.get_property("output_mesh"))

selection = k3d.mesh_selection.deselect_all()
selection.points = k3d.mesh_selection.component_select_all()

modifier.mesh_selection = selection

modifier.amount1 = 0.1
modifier.amount2 = 0.1 

testing.mesh_comparison_to_reference(document, modifier.get_property("output_mesh"), "mesh.modifier.MorphPoints", 4)

예제 #10
0
#python

import testing
import k3d

document = k3d.new_document()
setup = testing.setup_mesh_reader_test(
    "K3DMeshReader", "mesh.modifier.NurbsRuledSurfaceReference.k3d")

modifier = setup.document.new_node("NurbsRuledSurface")
modifier.delete_original = False
modifier.mesh_selection = k3d.mesh_selection.select_all()

document.set_dependency(modifier.get_property("input_mesh"),
                        setup.reader.get_property("output_mesh"))

testing.mesh_comparison_to_reference(document,
                                     modifier.get_property("output_mesh"),
                                     "mesh.modifier.NurbsRuledSurface", 1)
예제 #11
0
#python

import testing

setup = testing.setup_mesh_source_test("LSystemParser")
setup.source.growth = 2
testing.mesh_comparison_to_reference(setup.document, setup.source.get_property("output_mesh"), "mesh.source.LSystemParser", 16)

예제 #12
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "ScalePoints")

setup.source.rows = 1
setup.source.columns = 1

mesh_selection = k3d.mesh_selection.select_all()
setup.modifier.mesh_selection = mesh_selection
setup.modifier.x = 2

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.selection.all", 1)
예제 #13
0
#python

import testing

setup = testing.setup_mesh_source_test("CreateTrimCurve")
grid = setup.document.new_node("NurbsGrid")
setup.document.set_dependency(setup.source.get_property("input_mesh"),
                              grid.get_property("output_mesh"))

testing.mesh_comparison_to_reference(setup.document,
                                     setup.source.get_property("output_mesh"),
                                     "mesh.modifier.CreateTrimCurve", 1)
예제 #14
0
#python

import testing

setup = testing.setup_mesh_source_test("LissajousCurve")
testing.mesh_comparison_to_reference(setup.document,
                                     setup.source.get_property("output_mesh"),
                                     "mesh.source.LissajousCurve", 24)
예제 #15
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCube", "PointsToBlobby")

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.PointsToBlobby", 1)
예제 #16
0
#python

import k3d
import testing

script_path = k3d.share_path() / k3d.filesystem.generic_path(
    "scripts/MeshSourceScript/simple_polyhedron.py")
script_file = file(str(script_path), "r")

setup = testing.setup_mesh_source_test("MeshSourceScript")
setup.source.script = script_file.read()

testing.mesh_comparison_to_reference(
    setup.document, setup.source.get_property("output_mesh"),
    "mesh.source.MeshSourceScript.simple_polyhedron", 2)
예제 #17
0
#python

import testing
import k3d

document = k3d.new_document()
setup = testing.setup_mesh_reader_test(
    "K3DMeshReader", "mesh.modifier.NurbsCloseCurveReference.k3d")

selection = k3d.mesh_selection.deselect_all()
component_selection = k3d.mesh_selection.component(0, 1,
                                                   k3d.selection.type.UNIFORM,
                                                   0, 1000, 1)
selection.add_component(component_selection)

modifier = setup.document.new_node("NurbsCloseCurve")
modifier.mesh_selection = selection
modifier.keep_ends = True

document.set_dependency(modifier.get_property("input_mesh"),
                        setup.reader.get_property("output_mesh"))

testing.mesh_comparison_to_reference(document,
                                     modifier.get_property("output_mesh"),
                                     "mesh.modifier.NurbsCloseCurve2", 1)
예제 #18
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyCylinder",
                                         "CylindricalWavePoints")

selection = k3d.mesh_selection.deselect_all()
selection.points = k3d.mesh_selection.component_select_all()

setup.source.u_segments = 4
setup.source.v_segments = 16

setup.modifier.mesh_selection = selection
setup.modifier.amplitude = 1

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.CylindricalWavePoints", 0)
예제 #19
0
#python

import k3d
import testing
import benchmarking

document = k3d.new_document()

sphere = document.new_node("PolySphere")
torus = document.new_node("PolyTorus")

cgal_boolean = document.new_node("CGALBoolean")
cgal_boolean.create_property("k3d::mesh*", "input_1", "Input 1", "")
cgal_boolean.create_property("k3d::mesh*", "input_2", "Input 2", "")

document.set_dependency(cgal_boolean.get_property("input_1"), sphere.get_property("output_mesh"))
document.set_dependency(cgal_boolean.get_property("input_2"), torus.get_property("output_mesh"))

profiler = document.new_node("PipelineProfiler")
testing.mesh_comparison_to_reference(document, cgal_boolean.get_property("output_mesh"), "mesh.modifier.CGALBoolean.benchmark", 1)
benchmarking.print_profiler_records(profiler.records)
print """<DartMeasurement name="Total Boolean Time" type="numeric/float">""" + str(benchmarking.total_profiler_time(profiler.records)) + """</DartMeasurement>"""
예제 #20
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("PolyGrid", "ExtrudeFaces")

setup.source.rows = 3
setup.source.columns = 3

mesh_selection = k3d.mesh_selection.deselect_all()
mesh_selection.faces = [(4, 5, 1)]
setup.modifier.mesh_selection = mesh_selection
setup.modifier.distance = 5

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.ExtrudeFaces", 2)
예제 #21
0
#python

import k3d
import testing
import math

setup = testing.setup_mesh_modifier_test("PolyCube", "CalculateNormals")
setup.modifier.mesh_selection = k3d.mesh_selection.select_all()
setup.modifier.max_angle = math.radians(91.0)
setup.modifier.uniform = True
setup.modifier.face_varying = True
setup.modifier.vertex = True
setup.modifier.uniform_array = "Nu"
setup.modifier.face_varying_array = "Nf"
setup.modifier.vertex_array = "Nv"

testing.mesh_comparison_to_reference(setup.document, setup.modifier.get_property("output_mesh"), "mesh.modifier.CalculateNormals.2", 1)

예제 #22
0
#python

import k3d
import testing

document = k3d.new_document()

source = document.new_node("PolySphere")

triangles = document.new_node("TriangulateFaces")
triangles.mesh_selection = k3d.select_all()
document.set_dependency(triangles.get_property("input_mesh"), source.get_property("output_mesh"))

modifier = document.new_node("QuadrilateralRemeshing")
modifier.min_index = 0
modifier.max_index = 481
modifier.gradient_spacing = 1.1
modifier.iso_spacing = 1.1
document.set_dependency(modifier.get_property("input_mesh"), triangles.get_property("output_mesh"))

testing.mesh_comparison_to_reference(document, modifier.get_property("output_mesh"), "mesh.modifier.QuadrilateralRemeshing", 1)
예제 #23
0
#python

import testing
import k3d

document = k3d.new_document()
setup = testing.setup_mesh_modifier_test("NurbsCircle", "NurbsCreateCap")

selection = k3d.mesh_selection.select_all()
setup.modifier.mesh_selection = selection

testing.mesh_comparison_to_reference(
    document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.NurbsCreateCap", 1)
예제 #24
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test2("PolyCube", "TranslatePoints", "CenterPoints")

selection = k3d.mesh_selection.deselect_all()
selection.points = k3d.mesh_selection.component_select_all()

setup.modifier1.mesh_selection = selection
setup.modifier1.x = 1.0
setup.modifier1.y = 2.0
setup.modifier1.z = 3.0

setup.modifier2.mesh_selection = selection
setup.modifier2.center_x = True
setup.modifier2.center_y = True
setup.modifier2.center_z = True

testing.mesh_comparison_to_reference(setup.document, setup.modifier2.get_property("output_mesh"), "mesh.modifier.CenterPoints", 1)

예제 #25
0
#python

import testing

setup = testing.setup_mesh_source_test("BlobbyEllipsoid")
testing.mesh_comparison_to_reference(setup.document,
                                     setup.source.get_property("output_mesh"),
                                     "mesh.source.BlobbyEllipsoid", 2)
예제 #26
0
#python

import k3d
import testing

script_path = k3d.share_path() / k3d.filesystem.generic_path(
    "scripts/MeshSourceScript/teapots.py")
script_file = file(str(script_path), "r")

setup = testing.setup_mesh_source_test("MeshSourceScript")
setup.source.script = script_file.read()

testing.mesh_comparison_to_reference(setup.document,
                                     setup.source.get_property("output_mesh"),
                                     "mesh.source.MeshSourceScript.teapots", 2)
예제 #27
0
#python

import testing

setup = testing.setup_mesh_source_test("NurbsCone")
testing.mesh_comparison_to_reference(setup.document, setup.source.get_property("output_mesh"), "mesh.source.NurbsCone", 2)

예제 #28
0
#python

import testing
import k3d

document = k3d.new_document()
setup = testing.setup_mesh_reader_test(
    "K3DMeshReader", "mesh.modifier.NurbsExtrudePatchReference.k3d")

modifier = setup.document.new_node("NurbsPolygonizePatch")

document.set_dependency(modifier.get_property("input_mesh"),
                        setup.reader.get_property("output_mesh"))

testing.mesh_comparison_to_reference(document,
                                     modifier.get_property("output_mesh"),
                                     "mesh.modifier.NurbsPolygonizePatch", 16)
예제 #29
0
#python

import k3d
import testing

document = k3d.new_document()

source = document.new_node("PolyTorus")

triangles = document.new_node("TriangulateFaces")
triangles.mesh_selection = k3d.select_all()
document.set_dependency(triangles.get_property("input_mesh"), source.get_property("output_mesh"))

modifier = document.new_node("PGPRemesh")
modifier.use_smooth = False
modifier.steps = 0
modifier.omega = 1
modifier.div = 2
modifier.triangulate = True
document.set_dependency(modifier.get_property("input_mesh"), triangles.get_property("output_mesh"))

#print "source output: " + repr(source.output_mesh)
#print "triangles output: " + repr(triangles.output_mesh)
#print "modifier output: " + repr(modifier.output_mesh)

testing.mesh_comparison_to_reference(document, modifier.get_property("output_mesh"), "mesh.modifier.PGPRemesh", 1)

예제 #30
0
#python

import k3d
import testing

setup = testing.setup_mesh_modifier_test("NurbsGrid", "NurbsSplitPatch")

setup.modifier.mesh_selection = k3d.mesh_selection.select_all()
setup.modifier.u_value = 0.147
setup.modifier.insert_to_v = True

testing.mesh_comparison_to_reference(
    setup.document, setup.modifier.get_property("output_mesh"),
    "mesh.modifier.NurbsSplitPatch2", 16)