-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix 5091. Add a Node center of mass for a one or multiple meshes #5092
Merged
satabol
merged 8 commits into
master
from
fix_5091_Add_a_Node_center_of_mass_for_a_one_or_multiple_meshes
Apr 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5db0277
- append new node to calculate center of mass for several meshes and …
satabol d18ca7f
- fixed by code review:
satabol 1297a0b
optimize for loop
satabol e0aabc6
- refactor calculate function to module utils\sv_bmesh_utils->calc_ce…
satabol a6a586c
- fix mutable value as default
satabol 482e161
- rename output sockets
satabol 6296e39
test fail building_docs_test.yml
satabol ccdd1ed
undo building_docs_test.yml
satabol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
Weighted Vector Sum (Alpha) | ||
=========================== | ||
|
||
.. image:: https://github.com/nortikin/sverchok/assets/14288520/d4ea8073-e205-4a93-867e-55c77ac81f4d | ||
:target: https://github.com/nortikin/sverchok/assets/14288520/d4ea8073-e205-4a93-867e-55c77ac81f4d | ||
|
||
Functionality | ||
------------- | ||
|
||
Calculate centers of mass every input mesh (with mass verts or density of materials) and calculate total center of mass: | ||
|
||
By edges and density: | ||
|
||
.. image:: https://github.com/nortikin/sverchok/assets/14288520/23b5b892-ba5d-491a-b900-503d09242e97 | ||
:target: https://github.com/nortikin/sverchok/assets/14288520/23b5b892-ba5d-491a-b900-503d09242e97 | ||
|
||
Extrapolates lists of mass of vertices: | ||
|
||
.. image:: https://github.com/nortikin/sverchok/assets/14288520/bde8dfeb-ace0-4eac-b5b8-195f1700ac99 | ||
:target: https://github.com/nortikin/sverchok/assets/14288520/bde8dfeb-ace0-4eac-b5b8-195f1700ac99 | ||
|
||
Using of modifier stack: | ||
|
||
.. image:: https://github.com/nortikin/sverchok/assets/14288520/027a572b-e764-4009-b08b-b1acff23bb27 | ||
:target: https://github.com/nortikin/sverchok/assets/14288520/027a572b-e764-4009-b08b-b1acff23bb27 | ||
|
||
Inputs | ||
------ | ||
|
||
- **Vertices** - or a nested list of vertices that represent separate objects. | ||
- **Edges** - Edges of meshes. | ||
- **Polygons** - Polygons of meshes. | ||
- **Mass of vertices** - Calculate of centers of mass only with vertices (ignore edges and faces). Default value is 1 mass (ex. kg, ton etc.). | ||
- **Density** - Calculate of centers of mass only with edges or faces and ignore vertices. Default value is 1 mass/volume. | ||
|
||
Parameters | ||
---------- | ||
|
||
- **Skip unmanifold centers** - True: If some meshes cannot be used to calc centers of mass then skip them. False - show exception | ||
|
||
.. image:: https://github.com/nortikin/sverchok/assets/14288520/c23429a9-44c3-47b6-bd8e-817d1cf6e4eb | ||
:target: https://github.com/nortikin/sverchok/assets/14288520/c23429a9-44c3-47b6-bd8e-817d1cf6e4eb | ||
|
||
- **Center mode** - select mode to calculate center of mass (Vertices, edges, faces or volumes) | ||
|
||
.. image:: https://github.com/nortikin/sverchok/assets/14288520/c5bc5545-9d2a-42f0-bc59-c48caee94165 | ||
:target: https://github.com/nortikin/sverchok/assets/14288520/c5bc5545-9d2a-42f0-bc59-c48caee94165 | ||
|
||
for modes **Vertices** and **Edges** triangulations are disabled (not used): | ||
|
||
.. image:: https://github.com/nortikin/sverchok/assets/14288520/a9136534-a9b2-4fbe-982e-45d56a437a0b | ||
:target: https://github.com/nortikin/sverchok/assets/14288520/a9136534-a9b2-4fbe-982e-45d56a437a0b | ||
|
||
- **Triangulation** - used only for **Faces** or **Volumes** mode. Calculations of center of mass do triangulations before calculations. | ||
|
||
.. image:: https://github.com/nortikin/sverchok/assets/14288520/d3853de6-7a49-4658-87ec-c9e3b84fc3b3 | ||
:target: https://github.com/nortikin/sverchok/assets/14288520/d3853de6-7a49-4658-87ec-c9e3b84fc3b3 | ||
|
||
Output | ||
------ | ||
|
||
.. image:: https://github.com/nortikin/sverchok/assets/14288520/7de47244-453c-4029-bd6d-916365fd1197 | ||
:target: https://github.com/nortikin/sverchok/assets/14288520/7de47244-453c-4029-bd6d-916365fd1197 | ||
|
||
- **Vertices** - Vertices of result meshes | ||
- **Edges** - Edges of result meshes (Triangulated after **Face** or **Volume** mode) | ||
- **Faces** - Faces of result meshes (Triangulated after **Face** or **Volume** mode) | ||
- **Center of mass of objects** - Center of mass of every input meshes that can be calculated | ||
- **Total center** - If there are any center of mass then this parameter contains center of mass of all meshes (depends of input params **Mass of vertices** or **Density**) | ||
- **Counts**, **Lengths**, **Areas**, **Volumes** - params of meshes | ||
- **Total Counts**, **Total Lengths**, **Total Areas**, **Total Volumes** - Total params of meshes | ||
- **Masses** - List of mass of every input meshes (**Vertices** mode: total summa of vertices mass, **Edges** mode: multiply length*density, **Faces** mode: multiply areas*density, **Volumes** mode: multiply volumes*density) | ||
- **Mass** - Summary mass of all calculated meshes | ||
- **Mask** - Mask of calculated objects. Example: if Mode is Volume and mashes are [cube1, plane1, vertex1, cube2] then mask is [ True, False, False, True] | ||
|
||
Examples | ||
-------- | ||
|
||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to name the node "Center of Mass - Mesh" (as opposed to existing Center of Mass node for solids; maybe that node should be renamed to "Center of Mass - Solid", for clarity).