mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-06 02:30:55 -08:00
Merge pull request #1062 from Mx-El/Perspective-Render
Some checks failed
benchmarks / benchmarks (macos-13, 3.12) (push) Has been cancelled
benchmarks / benchmarks (macos-14, 3.12) (push) Has been cancelled
benchmarks / benchmarks (ubuntu-latest, 3.12) (push) Has been cancelled
benchmarks / benchmarks (windows-latest, 3.12) (push) Has been cancelled
Upload coverage reports to Codecov / run (push) Has been cancelled
pylint / lint (3.10) (push) Has been cancelled
Run type checker / typecheck (3.10) (push) Has been cancelled
Run type checker / typecheck (3.13) (push) Has been cancelled
Wheel building and publishing / Build wheel on ubuntu-latest (push) Has been cancelled
tests / tests (macos-13, 3.10) (push) Has been cancelled
tests / tests (macos-13, 3.13) (push) Has been cancelled
tests / tests (macos-14, 3.10) (push) Has been cancelled
tests / tests (macos-14, 3.13) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.10) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.13) (push) Has been cancelled
tests / tests (windows-latest, 3.10) (push) Has been cancelled
tests / tests (windows-latest, 3.13) (push) Has been cancelled
Wheel building and publishing / upload_pypi (push) Has been cancelled
Some checks failed
benchmarks / benchmarks (macos-13, 3.12) (push) Has been cancelled
benchmarks / benchmarks (macos-14, 3.12) (push) Has been cancelled
benchmarks / benchmarks (ubuntu-latest, 3.12) (push) Has been cancelled
benchmarks / benchmarks (windows-latest, 3.12) (push) Has been cancelled
Upload coverage reports to Codecov / run (push) Has been cancelled
pylint / lint (3.10) (push) Has been cancelled
Run type checker / typecheck (3.10) (push) Has been cancelled
Run type checker / typecheck (3.13) (push) Has been cancelled
Wheel building and publishing / Build wheel on ubuntu-latest (push) Has been cancelled
tests / tests (macos-13, 3.10) (push) Has been cancelled
tests / tests (macos-13, 3.13) (push) Has been cancelled
tests / tests (macos-14, 3.10) (push) Has been cancelled
tests / tests (macos-14, 3.13) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.10) (push) Has been cancelled
tests / tests (ubuntu-latest, 3.13) (push) Has been cancelled
tests / tests (windows-latest, 3.10) (push) Has been cancelled
tests / tests (windows-latest, 3.13) (push) Has been cancelled
Wheel building and publishing / upload_pypi (push) Has been cancelled
add ability to do perspective projection
This commit is contained in:
commit
7c19910382
1 changed files with 8 additions and 1 deletions
|
|
@ -920,6 +920,7 @@ class Mixin1D(Shape):
|
|||
viewport_origin: VectorLike,
|
||||
viewport_up: VectorLike = (0, 0, 1),
|
||||
look_at: VectorLike | None = None,
|
||||
focus: float | None = None,
|
||||
) -> tuple[ShapeList[Edge], ShapeList[Edge]]:
|
||||
"""project_to_viewport
|
||||
|
||||
|
|
@ -931,6 +932,8 @@ class Mixin1D(Shape):
|
|||
Defaults to (0, 0, 1).
|
||||
look_at (VectorLike, optional): point to look at.
|
||||
Defaults to None (center of shape).
|
||||
focus (float, optional): the focal length for perspective projection
|
||||
Defaults to None (orthographic projection)
|
||||
|
||||
Returns:
|
||||
tuple[ShapeList[Edge],ShapeList[Edge]]: visible & hidden Edges
|
||||
|
|
@ -963,7 +966,11 @@ class Mixin1D(Shape):
|
|||
gp_Ax1(viewport_origin.to_pnt(), projection_dir.to_dir())
|
||||
)
|
||||
camera_coordinate_system.SetYDirection(viewport_up.to_dir())
|
||||
projector = HLRAlgo_Projector(camera_coordinate_system)
|
||||
projector = (
|
||||
HLRAlgo_Projector(camera_coordinate_system, focus)
|
||||
if focus
|
||||
else HLRAlgo_Projector(camera_coordinate_system)
|
||||
)
|
||||
|
||||
hidden_line_removal.Projector(projector)
|
||||
hidden_line_removal.Update()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue