Skip to main content

Python Binding for Efficiently Combining Positions and Normals for Precise 3D Geometry

Project description

normal-position-combination

Python Binding for Efficiently Combining Positions and Normals for Precise 3D Geometry

PyPI version Build & Test Publish to Pypi

Before After Before After
Before After Before After
Efficiently Combining Positions and Normals for Precise 3D Geometry

Nehab, D.; Rusinkiewicz, S.; Davis, J.; Ramamoorthi, R.
ACM Transactions on Graphics - SIGGRAPH 2005
Los Angeles, California, July 2005, Volume 24, Issue 3, pp. 536-543

Original C++ implementation: normal-position-combination

Install

pip install normal-position-combination

Usage

First you need to have a mesh with (relatively) accurate vertex normals. The method will optimize the vertex positions to better fit the normals.

Process a trimesh.Trimesh Object

import trimesh
import normal_position_combination as npc
mesh = trimesh.load_mesh('./sample_data/panel.ply')
optimized_mesh = npc.process_trimesh(mesh)

Process on numpy Arrays

Input mesh vertices, faces, and normals as numpy arrays, and get the optimized vertices.

import numpy as np
import normal_position_combination as npc
mesh = trimesh.load_mesh('./sample_data/panel.ply')
optimized_vertices = npc.process_ndarray(
    np.array(mesh.vertices, dtype=np.float32),
    np.array(mesh.faces, dtype=np.int64),
    np.array(mesh.vertex_normals, dtype=np.float32),
)

Directly Process a Mesh File

import normal_position_combination as npc
npc.process_mesh_file(
    input_filename='./sample_data/panel.ply',
    output_filename='./sample_data/processed-panel.ply'
)

Parameters

Please refer to the original implementation's manual for the detailed explanation of the parameters.

Build from Source

Ubuntu / Debian

# build trimesh2
sudo apt install libglu1-mesa libglu1-mesa-dev libxi-dev
cd submodules/trimesh2
make -j

# build normal-position-combination
cd ../..
sudo apt install libsuitesparse-dev
pip install .

RHEL Series

sudo yum install mesa-libGLU mesa-libGLU-devel libXi-devel suitesparse-devel openblas-devel libomp-devel
cd submodules/trimesh2
make -j

cd ../..
sudo yum install suitesparse-devel
pip install .

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

normal-position-combination-0.0.3.tar.gz (8.9 MB view details)

Uploaded Source

Built Distributions

normal_position_combination-0.0.3-cp312-abi3-manylinux_2_28_x86_64.whl (6.4 MB view details)

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

normal_position_combination-0.0.3-cp311-cp311-manylinux_2_28_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

normal_position_combination-0.0.3-cp310-cp310-manylinux_2_28_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

normal_position_combination-0.0.3-cp39-cp39-manylinux_2_28_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

normal_position_combination-0.0.3-cp38-cp38-manylinux_2_28_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

File details

Details for the file normal-position-combination-0.0.3.tar.gz.

File metadata

File hashes

Hashes for normal-position-combination-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f07031123dfc527f0f477bdd6dfe9c9afd95a9d971ec3d25673322c3ccc9fce0
MD5 df00994f9c262666127b134ad36b6e00
BLAKE2b-256 5048b3fcb225c243571482e7773a5da68786bd88717c2382bf2627b346e5e558

See more details on using hashes here.

File details

Details for the file normal_position_combination-0.0.3-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for normal_position_combination-0.0.3-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ec38cb845e39fba42b24760ba6e1f460652cd0d44edb1dfacb73b9b2da2498a9
MD5 84dc484053ee68ce94178de4125a3ad8
BLAKE2b-256 d7841ea4c3d58366014fc5aee2758c6123331d1c7c86a5d292c98ff93d2050a8

See more details on using hashes here.

File details

Details for the file normal_position_combination-0.0.3-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for normal_position_combination-0.0.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0230e35ed2a430c83bef46e83b9c8731c3ea23cdeac733ca6bb2cc61e01e9501
MD5 ed54cef115b5552316ca481465e1b8b3
BLAKE2b-256 8d72f7ba0b82dd17e5f84810b7021f2778f224c2f2725f401384eff1fec0cfa9

See more details on using hashes here.

File details

Details for the file normal_position_combination-0.0.3-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for normal_position_combination-0.0.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bc1a6d8ee99582563fb614576a7255959c36a5159e4ec8895eb33aaed0df4b0b
MD5 cbb15d4a516a2637dff5b6eb66beb8fb
BLAKE2b-256 4e6d9344b22a5ee4a2ac369691a552ba186056a54ddf3802af4386435056c59e

See more details on using hashes here.

File details

Details for the file normal_position_combination-0.0.3-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for normal_position_combination-0.0.3-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6a04ab7fd955e215379fb3ea05ad8e5b1fe0769685e215d3c134dcc75cb321df
MD5 f67c3b5ecadf8c51b1d64ed1e44ee7d3
BLAKE2b-256 5bec8511bf455492ea78a0438e31dc9c0036399be6b46da0a40df4d15816f58b

See more details on using hashes here.

File details

Details for the file normal_position_combination-0.0.3-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for normal_position_combination-0.0.3-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b855bec9b43d146ab3292891b50a4dabb09ccd6527dd0defda5b26dbdc553c06
MD5 57ebbadabec5222ccd4132ac6de751be
BLAKE2b-256 9144a7c9119004167f70c95593a9c0b8ff60cf5e75d2102aebe70be055829a16

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