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 hashes)

Uploaded Source

Built Distributions

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

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 hashes)

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 hashes)

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 hashes)

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 hashes)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

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