mpacts.commands.geometry. nodenormals

In order to be able to use this module import it like this:

import mpacts.commands.geometry.nodenormals
#or assign it to a shorter name
import mpacts.commands.geometry.nodenormals as nod

ComputeNodeNormalsCommand

class mpacts.commands.geometry.nodenormals.ComputeNodeNormalsCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Computes the normals of nodes (corners of triangles) as the average of all the normals of surrounding triangles. The node manager (given as a property) needs to have an array with a std::vector<R3::Index_t> see: ComputeTriangleIndexListCommand). Note that this method does NOT weight the normals with corresponding voronoi areas. For that see ComputeWeightedNodeNormalsCommand!
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • nodes — Array Manager containing the nodes of the deformable body.
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • normal (default value = None) — Array with normals on the nodes that will be set. If not given, array with name ‘normal’ will be searched (or created) in ‘nodes’ array manager
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, nodes, [gate, predicate, normal]
ComputeNodeNormalsCommand(name, parent, **kwargs)

ComputeQuadNodeNormalsCommand

class mpacts.commands.geometry.nodenormals.ComputeQuadNodeNormalsCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Computes the normals of nodes (corners of ngons) as the average of all the normals of surrounding quads.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • nodes — Array Manager containing the nodes of the deformable body.
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • normal (default value = None) — Array with normals on the nodes that will be set. If not given, array with name ‘normal’ will be searched (or created) in ‘nodes’ array manager
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, nodes, [gate, predicate, normal]
ComputeQuadNodeNormalsCommand(name, parent, **kwargs)

ComputeSimplyWeightedNodeNormalsCommand

class mpacts.commands.geometry.nodenormals.ComputeSimplyWeightedNodeNormalsCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Specifically for triangles: computes the normals of nodes (corners of Triangles) as the average of all the normals of surrounding triangles. The node manager (given as a property) needs to have an array with a std::vector<R3::Index_t> (see: ComputeTriangleIndexListCommand). The formula used for weighted averaging is \vec{n} \propto \sum_i \frac{\sin \alpha_i}{d_i} \vec{n}_i, where \alpha_i is the angle of the triangle at node where we compute the node normal and d_i denotes the length of the opposite edge to the angle \alpha_i. See T. Langer, A. G. Belyaev, and H.-P. Seidel, Analysis and Design of Discrete Normals and Curvatures (2005). Hence, for triangles, this method should be superior to ComputeNodeNormalsCommand.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • triangles — Array Manager containing triangles that surround each node.
    • x — Array with positions of the triangle corners
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, triangles, x, [gate, predicate]
ComputeSimplyWeightedNodeNormalsCommand(name, parent, **kwargs)

ComputeWeightedNodeNormalsCommand

class mpacts.commands.geometry.nodenormals.ComputeWeightedNodeNormalsCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Specifically for triangles: computes the normals of nodes (corners of Triangles) as the average of all the normals of surrounding triangles. The node manager (given as a property) needs to have an array with a std::vector<R3::Index_t> (see: ComputeTriangleIndexListCommand). The voronoi areas of each surrounding triangle is used to weight the contribution of each surrounding triangle. Hence, for triangles, this method should be superior to ComputeNodeNormalsCommand. Note that ComputeCurvatureCommand has a lot of duplicated functionality compared to this one (and duplicated code) and handles better corner cases.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • triangles — Array Manager containing triangles that surround each node.
    • x — Array with positions of the triangle corners
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
    • turning_angle_min_degrees (default value = 5) — Minimum turning angle in degrees for which the node normals will be calculated exactly with the weighted node normal algorith. For low turning angles, this algorith is ill definded. However in this case, all the triangle normal will be very similar.Therefore, the average of the vector normals is taken in this case.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, triangles, x, [gate, predicate, turning_angle_min_degrees]
ComputeWeightedNodeNormalsCommand(name, parent, **kwargs)