Skip to main content

A small geometry processing package for mesh planarization

Project description

Make Planar Faces Plus

A small geometry processing package for mesh planarization written in C++.

Badge referencing TinyAD.

Here is an example to get you started

# necessary imports 
from mpfp import make_planar_faces, MakePlanarSettings
# prepare mesh data (in praxis you would create this data from your mesh)
vertices = [[0,0,0], [1,0,0], [1,1,0], [0,1,1]]
faces = [[0,1,2,3]]
fixed_vertices = [0,1,2]
# here is a list of all available settings (with default values):
opt_settings = MakePlanarSettings()
opt_settings.optimization_rounds = 100
opt_settings.max_iterations = 100
opt_settings.closeness_weight = 10
opt_settings.min_closeness_weight = 0.0
opt_settings.verbose = True
opt_settings.projection_eps = 1e-16
opt_settings.w_identity = 1e-16
opt_settings.convergence_eps = 1e-16
# optimize
optimized_vertices = make_planar_faces(vertices, faces, fixed_vertices, opt_settings)
# print the result
print(optimized_vertices)

How to encode your Mesh

You provide your mesh to the make_planar_faces function via the two parameters:

  • vertices: A list of 3D vertex coordinates. You can provide them as a 2d list or a numpy array with shape (n, 3).
  • faces: A list of all mesh faces. Each face has to be provided as a list of vertex indices in ccw or cw order.

Details

The function provided by this module aims to make each face of a mesh planar. It solves a global optimization problem in order to make faces planar while preserving the objects shape as much as possible.

You can control the strength of this shape preservation objective via the closeness_weight and min_closeness_weight parameter. The algorithm will interpolate between the two while optimizing. If you struggle to get decent results, try increasing the closeness_weight and the number of optimization rounds.

The algorithm will always try to optimize the entire mesh. By providing the index list fixed_vertices, all selected vertices will be ignored by the optimizer. This may be useful when you want to preserve certain features.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mpfp-1.0.2-cp311-cp311-win_amd64.whl (211.7 kB view details)

Uploaded CPython 3.11Windows x86-64

mpfp-1.0.2-cp311-cp311-win32.whl (186.4 kB view details)

Uploaded CPython 3.11Windows x86

mpfp-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

mpfp-1.0.2-cp311-cp311-musllinux_1_2_i686.whl (1.4 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ i686

mpfp-1.0.2-cp311-cp311-musllinux_1_2_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ ARM64

mpfp-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (254.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

mpfp-1.0.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (258.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

mpfp-1.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (240.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

mpfp-1.0.2-cp311-cp311-macosx_11_0_arm64.whl (186.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mpfp-1.0.2-cp311-cp311-macosx_10_13_x86_64.whl (207.8 kB view details)

Uploaded CPython 3.11macOS 10.13+ x86-64

File details

Details for the file mpfp-1.0.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: mpfp-1.0.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 211.7 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5368a712f6ca1fbb378ad9cfe879a5896adb48cd6cb21b4700fcbc42f64e0359
MD5 13fec2187fcd97692fb7b920e3adde48
BLAKE2b-256 2a04921bb2936b0ffa28b52fff9674a44847e4ed4788ab729796bf79c71da1ff

See more details on using hashes here.

File details

Details for the file mpfp-1.0.2-cp311-cp311-win32.whl.

File metadata

  • Download URL: mpfp-1.0.2-cp311-cp311-win32.whl
  • Upload date:
  • Size: 186.4 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 c3040f839512001910f639d51c669b41897fbabdcec06949844381fc5c6fdd22
MD5 3b506111c5d614073275019a6f491be9
BLAKE2b-256 85af0c9894b2dadaedeaac7bb11bfe3b2f6989a7896e8b267f7c247717eaa41b

See more details on using hashes here.

File details

Details for the file mpfp-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dcf9bc2a65f063d809e5c0da027b1876fcde2e8fe152a2d0f63599725a1753e7
MD5 8e45398fb4fe4349bf6a531785a0687f
BLAKE2b-256 13e15c23355124af677a15a7eb89614683d80dc59557bc967889b398a976d5c7

See more details on using hashes here.

File details

Details for the file mpfp-1.0.2-cp311-cp311-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2cacb11e3d1b786e633afe625b4e29d1e35793f7066c088f78c27b857c50d351
MD5 e7d620f1289315371393aa9a9e60f576
BLAKE2b-256 92318351235a3f0065bf3df741591c6adfe2a2037bb77680b6303cb1b74d7dd3

See more details on using hashes here.

File details

Details for the file mpfp-1.0.2-cp311-cp311-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8250ca7d6442762f8b6393f3a2c56508259208bd1cff6afca1687f2d9dd7b33c
MD5 3dd727a8b41def099949696ceaf232f6
BLAKE2b-256 ef9ef755273ade869043d47362bc0dbfdd4d38db4f5a23a024873909ab0531f6

See more details on using hashes here.

File details

Details for the file mpfp-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eaa6ac51857b3aee047f03e50f5477ee1e652d7f41f92ae9b36659784cdecb77
MD5 14235f661b92fb19c15d1354e2c03b65
BLAKE2b-256 d886e9959d8ad4ff364c38788fa45f6574ad8f46d6ba7133817f48c0ae020557

See more details on using hashes here.

File details

Details for the file mpfp-1.0.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 4b55c6f1512cb4b8c4d141a1c71c8d900d4c4dc3d2f730a87df2d81db70203ad
MD5 b7cdd7f6fee48e56f708a968f1d4af56
BLAKE2b-256 9e0fe9edb32f70fc518bdc05b162fb989a1ee113f6817024eee92cf2a1a9cb0c

See more details on using hashes here.

File details

Details for the file mpfp-1.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9d6900b94d6ad91a1d1c4f5685afe18e5b636b7c8e5ec830b79b6a6dc1689de6
MD5 b740d575091a35236ea1d7d83eaffc10
BLAKE2b-256 75a93d1879303be8b5dd7408f3627b695d4db40f005e9202fc386b0f65142731

See more details on using hashes here.

File details

Details for the file mpfp-1.0.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce82780b0a112eb75ccccd7eddddbd4c1f143f1abfb286ec24feaa8c8ebad943
MD5 c73ce6c39c1db1bdecd0b950d7f68dec
BLAKE2b-256 3d7555eb4cdd818607477190403470dffa09582ecc2c010f1ad9b1b524610d0d

See more details on using hashes here.

File details

Details for the file mpfp-1.0.2-cp311-cp311-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for mpfp-1.0.2-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 b52347cd08cb1692c39bcb6e140be73c79abcc94c55fa39c43d88f78a609bd87
MD5 85986b199a5c97fea8261b05cb430437
BLAKE2b-256 f71644be0e16735a01de4a9280a86588aee46e022315fa0b2ea8f8e603afc7d3

See more details on using hashes here.

Supported by

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