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 = 50
opt_settings.max_iterations = 10
opt_settings.closeness_weight = 5
opt_settings.min_closeness_weight = 0.0
opt_settings.verbose = True
opt_settings.projection_eps = 1e-9
opt_settings.w_identity = 1e-9
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 Distribution

mpfp-1.0.3.tar.gz (1.6 MB view details)

Uploaded Source

Built Distributions

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

mpfp-1.0.3-cp311-cp311-win_amd64.whl (211.0 kB view details)

Uploaded CPython 3.11Windows x86-64

mpfp-1.0.3-cp311-cp311-win32.whl (185.6 kB view details)

Uploaded CPython 3.11Windows x86

mpfp-1.0.3-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.3-cp311-cp311-musllinux_1_2_i686.whl (1.4 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ i686

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

Uploaded CPython 3.11musllinux: musl 1.2+ ARM64

mpfp-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (254.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

mpfp-1.0.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (257.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

mpfp-1.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (235.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

mpfp-1.0.3-cp311-cp311-macosx_11_0_arm64.whl (185.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mpfp-1.0.3-cp311-cp311-macosx_10_13_x86_64.whl (206.8 kB view details)

Uploaded CPython 3.11macOS 10.13+ x86-64

File details

Details for the file mpfp-1.0.3.tar.gz.

File metadata

  • Download URL: mpfp-1.0.3.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for mpfp-1.0.3.tar.gz
Algorithm Hash digest
SHA256 68f697579ec2d8afc286c98b9eb96e4cd59eb9164085c8238347b874c632100b
MD5 c25d01ac18122fa32c13140c2573bd38
BLAKE2b-256 ea6546944d18cbca142790cd0acbf84d7724ca4051b59e40a5f8bb36c0039b85

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mpfp-1.0.3-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 211.0 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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ffb7b56f3d579dbf9971f257d593303c6b6d22d66feab33960db115e3b532cde
MD5 365b38435e970fcf530c0db4cf89072e
BLAKE2b-256 a6602e2779ec51670737d3915325e416579caca26b288438eae72916fb703c1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mpfp-1.0.3-cp311-cp311-win32.whl
  • Upload date:
  • Size: 185.6 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.3-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 e06d75568c6bb433ff787c96294e1c89988cad4ae4b7a765a1e043cd01a96536
MD5 36e3610843226498131056b0f922ac85
BLAKE2b-256 68e476013a20495bf89ba7f7d1c81d17957eed9e5ee9a621c567a6ea138e9446

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpfp-1.0.3-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9fb969e1bc1981a849b0faf93dd450b424883c496745dd462803747e00b5f000
MD5 280d8543b225180667c7631e44a74b85
BLAKE2b-256 295d046f392216bfe427f3bd6280befcfa97ab5cf238e4244c24ecf1d68b9e29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpfp-1.0.3-cp311-cp311-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 2d67cced0019e31d2277c1e72e31a3ee1c8c0f9f5160a2876d13c8272b0626b3
MD5 3423e67899f0850da0e1dc92ff27f990
BLAKE2b-256 f6ebe29144431629fb54d63a06dc1b98aca80b141867cb2dbf912fbfb7df1290

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpfp-1.0.3-cp311-cp311-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6fa629d79f81e697a8ce55646f51a2aa77c6267ef95dd2e929625c9264244d4d
MD5 05971e7ecffa7128ad59e49e3da645ce
BLAKE2b-256 26ca1fc6a8c78cf9f23e9afb1db6fd88a174d316e745b31509f0eecc6db9b2d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpfp-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c433b79a68358d2b9d3ec796de26d4e494805fc50bc55ab777db1af82e248ee7
MD5 0878a7b2dc0f99b67b6b4eb171bb8c44
BLAKE2b-256 3a1205b6652125e6a2c283b71856701037ffe9ac1b18b5814f246ed786b570a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpfp-1.0.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e25371e0ffb1152b30e051723fa66d74bbdf3352fbf17b7497f5c2d52fe94eed
MD5 ecdab68a89a2f5cecd69845f36fc92e3
BLAKE2b-256 51601519a75b745aa026457610bf8d63c445fc7117290e64d6ea248da09c7afc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpfp-1.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6f97a54104a80f891c3762ef769207f69b9aaad81bf9c38d331901a90f4f03af
MD5 555add1a73f7cea8085baf459de76474
BLAKE2b-256 e7bd8f3f6c381bea9577b1c6c934c18d1a8a1585c364bb4cb421235ce881d777

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpfp-1.0.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 88227339b6de7f05a1c747f67d45b9485105f702507664baa0188bfd3a912712
MD5 f6bc747e0e7004103323fa2928aca016
BLAKE2b-256 cb31119ad1bdbf1e91e90b5d14075d9e02fb3a786c136691591ba0cdd1c37ba9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mpfp-1.0.3-cp311-cp311-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a6a03630629010c9a01f9d36143505a455ed86c694cdae6d43ab5d560ee9d34c
MD5 1d0fc254d15442c0981ba1b892ee48d1
BLAKE2b-256 7b7b0b74d76ace59fc7c0333fdddc83b4e423b484484e3e2625a0ab31bb81ec0

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