Ejemplo n.º 1
0
Archivo: run.py Proyecto: nscherf/linus
        bary = tm.getBarycenter()
        print("New center is at:", bary)
        tm.translate(-bary[0], -bary[1], -bary[2])

    # Add optional auto-generated attributes
    if addTime is not None:
        tm.addAttributeTime()
    if addRadius is not None:
        tm.addAttributeRadius()
    if addAngle is not None:
        tm.addAttributeAngleToStart()

    tracks, attributes, names = tm.get()

    # Prepare the output
    wgb = dc.WebGlToolBuilder()

    # First, add background data. Note, we need the scale we derived from the tracks
    if stlPath is not None:
        triangles = dc.TriangleLoader()
        triangles.setScale(scale)
        triangles.setCenter(bary)
        triangles.addFromStl(stlPath)
        positions, indices, normals = triangles.get()
        wgb.addTriangleDataset(positions, indices, normals, "Context", scale)

    if objPath is not None:
        triangles = dc.TriangleLoader()
        triangles.setScale(scale)
        triangles.setCenter(bary)
        triangles.addFromObj(objPath)