Skip to main content

Python wrapper for Embree-3.

Project description

pyemblite python package pyemblite python package pyemblite python package BSD License pyemblite python package

Python wrapper for Embree-3. Source code adapted from pyembree Embree-2 wrapper.

Quick Start

Example:

import numpy as np
import trimesh
from trimesh.primitives import Sphere
from pyemblite.mesh_construction import TriangleMesh
from pyemblite.rtcore_scene import EmbreeScene

# Create Embree scene which holds meshes.
scene = EmbreeScene()

# Create a mesh using trimesh (https://github.com/mikedh/trimesh).
tmesh = Sphere(radius=5.0, subdivisions=1)

# Create Embree triangle mesh geometry
emesh = TriangleMesh(scene, tmesh.vertices, tmesh.faces)

# Commit the scene (builds spatial acceleration structures).
scene.commit()

# Generate ray origins and ray directions
ray_orgs = (
    np.zeros((tmesh.vertices.shape[0], 3), dtype=np.float32)
    +
    tmesh.centroid
).astype(np.float32)
ray_dirs = (tmesh.vertices - tmesh.centroid).astype(np.float32)
ray_dirs /= np.linalg.norm(ray_dirs, axis=1)[np.newaxis, 1]

# Query the index of the first face which gets hit by ray
# (index of -1 indicates ray did not hit a face)
primID = scene.run(ray_orgs, ray_dirs, query='INTERSECT')

# Query the distance from the ray origin where face which gets hit by ray
# Intersection points are ray_orgs + tfar * ray_dirs
tfar = scene.run(ray_orgs, ray_dirs, query='DISTANCE')
print(tfar)

# Query all info, intersect_info is a dict with keys:
# ['u', 'v', 'Ng', 'tfar', 'primID', 'geomID']
intersect_info = scene.run(ray_orgs, ray_dirs, output=True)

Installation

Install from latest github source:

$ python -m pip install --user setuptools cython wheel numpy 'versioneer[toml]'
$ python -m pip install --no-deps --no-build-isolation --user git+https://github.com/AppliedMathematicsANU/pyemblite.git#egg=pyemblite

or from source directory:

$ python -m pip install --user setuptools cython wheel numpy 'versioneer[toml]'
$ git clone git@github.com:AppliedMathematicsANU/pyemblite.git
$ cd pyemblite
$ python -m pip install --no-deps --no-build-isolation --user .

If you’re on windows, you can use vcpkg to manage non-python dependencies (can also be used on Linux and MacOS):

PS > git clone https://github.com/microsoft/vcpkg
PS > .\vcpkg\bootstrap-vcpkg.bat
PS > $Env:VCPKG_ROOT=$(Resolve-Path ./vcpkg)
PS > git clone git@github.com/AppliedMathematicsANU/pyemblite.git
PS > cd pyemblite
PS > python -m pip install --prefix=\path\to\install\root .

You also still need to have build tools installed (some kind of C/C++ compiler). One way to achieve this is to install Visual Studio Build tools. Visual studio build tools likely require the installation of visual studio community edition first. This link should (hopefully) get you started:

https://visualstudio.microsoft.com/downloads/

Requirements

Requires:

Testing

Run tests (unit-tests and doctest module docstring tests) using:

.. code-block:: console

python -m pyemblite.test

Latest source code

Source at github:

https://github.com/AppliedMathematicsANU/pyemblite

License information

See the file LICENSE.txt for terms & conditions, for usage and a DISCLAIMER OF ALL WARRANTIES.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyemblite-0.1.5.zip (53.9 MB view details)

Uploaded Source

Built Distributions

pyemblite-0.1.5-cp312-cp312-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.12 Windows x86-64

pyemblite-0.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (43.9 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

pyemblite-0.1.5-cp312-cp312-macosx_10_9_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyemblite-0.1.5-cp311-cp311-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyemblite-0.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (43.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

pyemblite-0.1.5-cp311-cp311-macosx_10_9_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyemblite-0.1.5-cp310-cp310-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyemblite-0.1.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (43.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

pyemblite-0.1.5-cp310-cp310-macosx_10_9_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyemblite-0.1.5-cp39-cp39-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyemblite-0.1.5-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (43.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.27+ x86-64 manylinux: glibc 2.28+ x86-64

pyemblite-0.1.5-cp39-cp39-macosx_10_9_x86_64.whl (10.0 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file pyemblite-0.1.5.zip.

File metadata

  • Download URL: pyemblite-0.1.5.zip
  • Upload date:
  • Size: 53.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for pyemblite-0.1.5.zip
Algorithm Hash digest
SHA256 1b14d63a87621356cb8267f684e0d5f913910b7d8020ad27fbceee34217628ea
MD5 10880ec9bd636162d996acdac77f1e0c
BLAKE2b-256 3bbb62610080eb7edf871e7b038025930a787d887d271de7af0f0498bc1102bb

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a920798eabce5b2fd1a1724fddc08523c1b4f94436dee3534b1d01ee6ffbcf85
MD5 17e0ac847dda7ba1a399ea0f54e6cccb
BLAKE2b-256 ddbc8cebc12791b95c2952f76cc2e1d30de54a1fdee09adda87ec055345976f6

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 effa2e9abad41022f72aaabdd159154ea8cec30360e9fcdc23303f48e4270aaa
MD5 32206030e86abf1f3cc6c1e5eef43175
BLAKE2b-256 888dffa39424c2519ad4a644a3c4fad55894c3fb13e4daef342bbba232e93878

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1ba1cc0110458477c9c6d93b2193ff410246bb6f90ade26bc297f95ded7de0e6
MD5 43ad39cd099ff68ab068f2b713836359
BLAKE2b-256 66e87696d575906636ec74a122987e9d38ea6e38c3c64e7b7df360879475cd7b

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bf3069e327060f5fe17689ce06aba771489c0db46a61d7dae3d8ca4484910373
MD5 85eddbabeba87c2b003417f9a9fb12bb
BLAKE2b-256 c12a066bedc72f39823c5ac65a8e4dcf804e60ad326fd5abedd0a1ff9858fdd1

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5ba65a48784361a8b82425f33262522c36d46c727448cefef3390fdd1226c4ad
MD5 bcd17a34bc26cc27edeb5a85d34dadbc
BLAKE2b-256 cb236be7755d2c55c6c93d7ac7ac55b84633c0aa6c228c02537b07b60b948f76

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c352c0629695c03311124d251ad2b97db71af2cf2d49f59a8ee2c57637ec1c1c
MD5 74f7c70d074291da303e6c9f09e0216b
BLAKE2b-256 fe40f639eef4323b30178696c4feef64318c474d6ab2e13385b52c9f65eb85c9

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0cdfbce7d4e7d614fe56c79c7d96bc7b234c110a80830002d0ded3160a06448c
MD5 73d54f07530ddc0889ee8b7fe4bdc8f0
BLAKE2b-256 e2d3f75279d690654fd576821021d1ed0f40305117865c61400754e217bdfbd8

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b9a34a6bb8d54cbaca19593528313543c54ca34d41ba95336c83e0c78af3fb74
MD5 6a8f3cac5b909a6108d8b2e510f7e04e
BLAKE2b-256 24b67ef17b8f3075ccca639ce848ebf203a0951ede4a2e2feb876fb475579d6f

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 702f1c739faeb092fb08ed98ec8abf7625aa0c10c0aabb738981fce293a19d40
MD5 7c7635e71ee761130544353c466b9aff
BLAKE2b-256 c93b537712b3f717d090cde74543f3c5ea514c82be45f6a3979625bae3557ecc

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pyemblite-0.1.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 7.5 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for pyemblite-0.1.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 8b51e9f928ba99616d18b3b46093ce03397a75ed9d53f0de16a92a6e77674198
MD5 73085660821c75e4d7b0bbc4b2aeabad
BLAKE2b-256 5ded475c55095493551d9a87e17c97a4d58694bea734f2a7dc1b3deedab06db8

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 64db8e94b681b17dbb827cc8657e50728229206ca6ced82d62607e47797e559f
MD5 ec6e14df905762c20cdca4cb90df3e33
BLAKE2b-256 80a270742fbeb4d41d63630ee69b6914a1c8053f41414f91d847173452fc4612

See more details on using hashes here.

File details

Details for the file pyemblite-0.1.5-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyemblite-0.1.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 99345bf53bba19ac86247445800418cc38b473ac21a5f886923db5d0c897c07a
MD5 874c460cb3fe11ee3746e78e6c6fd850
BLAKE2b-256 13ddd72eee83853338858d1aff22824ed3359fa230e4236b4c9f538c73d1b90f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page