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:

$ python -m pyemblite.test

or with fail-fast and verbosity:

$ python -m pyemblite.test -fv

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.6.zip (53.9 MB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

pyemblite-0.1.6-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.6-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.6-cp311-cp311-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.11 Windows x86-64

pyemblite-0.1.6-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.6-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.6-cp310-cp310-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.10 Windows x86-64

pyemblite-0.1.6-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.6-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.6-cp39-cp39-win_amd64.whl (7.5 MB view details)

Uploaded CPython 3.9 Windows x86-64

pyemblite-0.1.6-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.6-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.6.zip.

File metadata

  • Download URL: pyemblite-0.1.6.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.6.zip
Algorithm Hash digest
SHA256 f9fe697a6c10376256f792f5a6632bf587d4217d1df886b61a22e1e82bf6597f
MD5 21a298d183418af81188117a6afefeca
BLAKE2b-256 139749b6c3d73534706dfbbff978898bb8a982302705fab569cd9f51b6d8709f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a8e436359df7dc11339022293a3b9e2e03be587ba1f3fc1578c3b5bec199f943
MD5 99439ce30f2857b60fe992c49d5c08e7
BLAKE2b-256 1d83ec91c759c70794b4dda73d1fb82d95310ee2c84c5d321544d4f727b5454b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 874b3abd1eee243c0100878a7a18e4b264ac137c7517033fa9b6f2108324960d
MD5 dfa1271c298c37e25e3626e04d44c638
BLAKE2b-256 15b2ea67a7114e6dce6633f55902e04d0fc96275c00075e43e476a159f6e5368

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1b694eaf7470eb322dec1dbd16296a429b3b23acc583960f6f30696ae2bb442d
MD5 7230574685c197ec8a9e2a4e82e3920b
BLAKE2b-256 b4763fab0394385850da10c6bb2991e1b83534c383adb53c9464c7feeeb4b638

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 42c4aec6607c633c232ce76989e83fb7b320800ddfab7b799d5b91fac306ac46
MD5 2f6af266ea0c9a2fcac31c2c5c38649a
BLAKE2b-256 1a7d72494bb3e6121dd3c10089261071d690b6fa0ee2d7f94a1d07671a7944e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b1bcd9233e1a205b3a00ee6d912618a16bfd70ebf22157606239a787e9d628c1
MD5 eb46af875c6fefbe326326d999c80473
BLAKE2b-256 610fc697159e600bd4a31e36115d01bae1f7a73fd28d90b4f1822c0cd1d4c85f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0e35f4bd4c0db606df0128715677ad80530eea5780ff4b4efabcdc491ad9ab4a
MD5 e91407fc175ed4c1a9c10046df8c8101
BLAKE2b-256 2b6037d4e8669f8b636d5b22bd66c5a0537bf243b826ca8400910be22f0cd6cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 77d796ba26f37a8036a2a2eef0fc0b4b2c65b9d6573c04c93ce10f3a48c1ba71
MD5 713526a014e39c5592e594df8f1d57ec
BLAKE2b-256 1edf238e7beec51a1dca2e230865f70b38a24d4d4378759b05f00431c42b359b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 84ce874ffe62c6c41345aa539b4173b1af1a75fc38bf694e71adb0c7ded1ca4c
MD5 0addc436c6146ddbe53ec9fc51d358c0
BLAKE2b-256 ecaae08ee072f9b6ca05a8166a738cf7c9edd108253b4751b106d9ac14caab6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a2245f049723bc8668430a9f5ac6b20080f9a7229f9319f52215960b09972d1c
MD5 c88865849995808a3768ff1c183ce794
BLAKE2b-256 9bb191bc842224a8dc7e4925be944b88def908fa394a7101ee9df22ae25a50e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyemblite-0.1.6-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.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 836301ce3987491e602ab6bcab264f314bd11144ccbdcf004088c60a0af6c61f
MD5 95a59d31c637c60b8ec8d537a745d379
BLAKE2b-256 eae3cb8d4e6909b0a50d4c195f96f0e9867253fffa5c54bd2b1604691b4d5204

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a132b773a8f58a2c6d0ff8553da8bff4f35b2dfadb727b1e358222eadf379800
MD5 e4a12182e3abae7fa19bb38c8c2c2a13
BLAKE2b-256 77fbb1244a57f791b8a18bb8b1c8bd9e8a0ca6c4b2212018c4ff36bff1e93ef9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyemblite-0.1.6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5474e86688fb4ce9d2d11e0fc7b59a1c0f440da9cdb21f5db8c574d3e397beeb
MD5 ab3472ced79fa2ac9137bd40be1e57e7
BLAKE2b-256 97d8ff34ad485b20aa806bc64f952ceda19ac4578ca0443bd9b1012458fd54fa

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