Skip to content

Latest commit

 

History

History
105 lines (78 loc) · 2.54 KB

README.md

File metadata and controls

105 lines (78 loc) · 2.54 KB

hobart-svg

version license build docs build code style

Render polygons, polylines, and mesh cross sections to SVG.

Features

  • Render 2D and 3D polygons and polylines to SVG, with automatic computation of the bounding rectangle.
  • Render cross sections of lacecore-style polygonal meshes.

Installation

pip install hobart-svg

Usage

python -m hobart_svg.cli horizontal-xs \
    --reference vitra_with_xs.dae \
    examples/vitra/vitra_without_materials.obj \
    15 30 45 60
from hobart_svg import render_longest_xsection_to_svg
import lacecore
import numpy as np
from polliwog import Plane
import vg

mesh = lacecore.load_obj(filename="mesh.obj", triangulate=True)

plane = Plane(
    reference_point=np.array([0.0, 30.0, 0.0]),
    normal=vg.basis.y
)

render_longest_xsection_to_svg(
    mesh=mesh,
    plane=plane,
    filename="cross_section.svg")
from hobart_svg import render_longest_xsection_to_svg
import lacecore
from polliwog import Plane
from tri_again import Scene

mesh = lacecore.load_obj(
    filename="examples/vitra/vitra_without_materials.obj",
    triangulate=True
)
plane = Plane(
    reference_point=np.array([-0.869231, 60.8882, -20.1071]),
    normal=vg.normalize(np.array([0., 0.1, -1.]))
)
xs = render_longest_xsection_to_svg(
    mesh=mesh,
    plane=plane,
    filename="vitra_cross_section.svg"
)

Scene().add_meshes(mesh).add_lines(xs).write("vitra_with_cross_section.dae")

Development

First, install Poetry.

After cloning the repo, run ./bootstrap.zsh to initialize a virtual environment with the project's dependencies.

Subsequently, run ./dev.py install to update the dependencies.

License

The project is licensed under the two-clause BSD license.