EdgeSetGeometryAlgorithms
The `EdgeSetGeometryAlgorithms` class in the SOFA framework provides geometry information specifically for an edge topology, inheriting from `PointSetGeometryAlgorithms`. This class is designed to handle geometric operations related to edges within a mesh. It supports various data types such as `Rigid2Types`, `Rigid3Types`, and `Vec3Types` through template specialization. ### Role and Purpose: The primary role of this component is to facilitate the computation of geometrical properties associated with edges, including edge lengths, directions, intersections, and projections. Additionally, it supports drawing edge indices and actual edges in a visualization context, enhancing debugging and visualization capabilities within SOFA simulations. ### Interactions with Other Components: - **Topology Interaction**: It interacts closely with the topology of the mesh through methods that access edge data (`getEdgeVertexCoordinates`, `computeEdgeDirection`, etc.), requiring an underlying topology structure to be present. - **Drawing**: The `draw` method integrates with SOFA's visualization pipeline, enabling the rendering of edges and their indices using `core::visual::VisualParams`. - **Numerical Integration Points**: It manages cubature points for numerical integration on edges through methods like `defineEdgeCubaturePoints` and `getEdgeNumericalIntegrationDescriptor`, which are useful in finite element simulations involving edge elements. ### Practical Usage Guidance: The component provides various data fields such as `showEdgeIndices` (to display edge indices) and `_drawColor` (to set the color for drawing edges). The `computeLocalFrameEdgeWeights` method is particularly useful for computing deformation gradients at vertices, enabling more accurate simulations of deformable objects. ### Data Fields: - **showEdgeIndices**: A boolean to enable or disable viewing edge indices during visualization. - **d_drawEdges**: A boolean to enable drawing edges in the topology. - **_drawColor**: An `RGBAColor` field for setting the color used to draw edges.
- abstract
- The `EdgeSetGeometryAlgorithms` class provides geometric operations for edges within a mesh, including length computation, direction calculation, intersections, and projections. It supports visualization by displaying edge indices and drawing edges in specified colors.
- sheet
- # EdgeSetGeometryAlgorithms ## Overview The `EdgeSetGeometryAlgorithms` class is designed to handle geometric operations related to edges within a mesh topology. It inherits from `PointSetGeometryAlgorithms` and provides methods for computing edge lengths, directions, intersections, and projections. Additionally, it supports visualization by displaying edge indices and drawing edges in specified colors. ## Parameters and Data - **showEdgeIndices**: A boolean to enable or disable viewing edge indices during visualization. - **d_drawEdges**: A boolean to enable drawing edges in the topology. - **_drawColor**: An `RGBAColor` field for setting the color used to draw edges. ## Mathematical Model ### Edge Lengths The length of an edge is computed using the Euclidean distance between its two endpoints. Given vertices \(v_1\) and \(v_2\), the edge length \(L\) can be expressed as: \[ L = || v_1 - v_2 || = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \] ### Edge Directions The direction vector of an edge is computed by normalizing the difference between its endpoint coordinates. Given vertices \(v_1\) and \(v_2\), the direction vector \(τ\) can be expressed as: \[ τ = \frac{v_2 - v_1}{|| v_2 - v_1 ||} \] ### Barycentric Coordinates Barycentric coordinates are used to express a point in terms of the vertices of an edge. Given a point \(P\) and vertices \(v_1\) and \(v_2\), the barycentric coordinates \(λ_1\) and \(λ_2\) can be computed as: \[ λ_1 = \frac{|P - v_2|}{|v_1 - v_2|}, λ_2 = 1 - λ_1 \] ### Edge Intersection The intersection of two edges can be computed by solving a system of linear equations. Given the parametric forms of the lines defined by the edges, the intersection point \(P\) is found where the parameters \(τ\) and \(ς\) satisfy: \[ v_{11} + τ (v_{12} - v_{11}) = v_{21} + ς (v_{22} - v_{21}) \] where \(v_{ij}\) represents the coordinates of vertices for edge i.
- description
- The `EdgeSetGeometryAlgorithms` class in the SOFA framework provides geometry information specifically for an edge topology, inheriting from `PointSetGeometryAlgorithms`. This class is designed to handle geometric operations related to edges within a mesh. It supports various data types such as `Rigid2Types`, `Rigid3Types`, and `Vec3Types` through template specialization. ### Role and Purpose: The primary role of this component is to facilitate the computation of geometrical properties associated with edges, including edge lengths, directions, intersections, and projections. Additionally, it supports drawing edge indices and actual edges in a visualization context, enhancing debugging and visualization capabilities within SOFA simulations. ### Interactions with Other Components: - **Topology Interaction**: It interacts closely with the topology of the mesh through methods that access edge data (`getEdgeVertexCoordinates`, `computeEdgeDirection`, etc.), requiring an underlying topology structure to be present. - **Drawing**: The `draw` method integrates with SOFA's visualization pipeline, enabling the rendering of edges and their indices using `core::visual::VisualParams`. - **Numerical Integration Points**: It manages cubature points for numerical integration on edges through methods like `defineEdgeCubaturePoints` and `getEdgeNumericalIntegrationDescriptor`, which are useful in finite element simulations involving edge elements. ### Practical Usage Guidance: The component provides various data fields such as `showEdgeIndices` (to display edge indices) and `_drawColor` (to set the color for drawing edges). The `computeLocalFrameEdgeWeights` method is particularly useful for computing deformation gradients at vertices, enabling more accurate simulations of deformable objects. ### Data Fields: - **showEdgeIndices**: A boolean to enable or disable viewing edge indices during visualization. - **d_drawEdges**: A boolean to enable drawing edges in the topology. - **_drawColor**: An `RGBAColor` field for setting the color used to draw edges.
- maths
- # Mathematical and Physical Description of EdgeSetGeometryAlgorithms Component ## Overview The `EdgeSetGeometryAlgorithms` class in the SOFA framework provides a set of geometric algorithms specifically designed for edge-based topologies. These operations are crucial for various simulation tasks such as computing lengths, directions, intersections, and deformation gradients related to edges within a mesh. ## Geometric Properties ### Edge Lengths The length of an edge is computed using the Euclidean distance between its two endpoints. Given vertices \(v_1\) and \(v_2\), the edge length \(L\) can be expressed as: \[ L = || v_1 - v_2 || = \\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \] ### Edge Directions The direction vector of an edge is computed by normalizing the difference between its endpoint coordinates. Given vertices \(v_1\) and \(v_2\), the direction vector \(τ\) can be expressed as: \[ τ = \\frac{v_2 - v_1}{|| v_2 - v_1 ||} \] ### Barycentric Coordinates Barycentric coordinates are used to express a point in terms of the vertices of an edge. Given a point \(P\) and vertices \(v_1\) and \(v_2\), the barycentric coordinates \(λ_1\) and \(λ_2\) can be computed as: \[ λ_1 = \\frac{|P - v_2|}{|v_1 - v_2|}, λ_2 = 1 - λ_1 \] ### Edge Intersection The intersection of two edges can be computed by solving a system of linear equations. Given the parametric forms of the lines defined by the edges, the intersection point \(P\) is found where the parameters \(τ\) and \(ς\) satisfy: \[ v_{11} + τ (v_{12} - v_{11}) = v_{21} + ς (v_{22} - v_{21}) \] where \(v_{ij}\) represents the coordinates of vertices for edge i. ## Physical Properties ### Deformation Gradients and Local Frames The deformation gradient at each vertex is computed using a pseudo-inverse approach. Given edges around a vertex, the weights are calculated to ensure that the weighted sum of the edge directions approximates an identity matrix. This allows the computation of rotated and deformed bases for each vertex during simulation. Given edges \(E\) around a vertex, the weight vector \(ω_i\) is computed as: \[ ω_i = V_t^i (V V_t)^{-1} I_3 \] where \(V\) and \(V_t\) are matrices of edge directions, and \(I_3\) represents the identity matrix. ### Integration Points Numerical integration points on edges are used to discretize integrals over the edge for finite element methods. These points are defined based on specific rules (e.g., Gaussian quadrature), enabling accurate computation of various physical quantities such as forces and stresses along the edge. ## Visualization Support The component supports visualization by providing options to display edge indices and draw edges in different colors, aiding in debugging and visual verification during simulations.
{
"name": "EdgeSetGeometryAlgorithms",
"main": {
"name": "EdgeSetGeometryAlgorithms",
"namespace": "sofa::component::topology::container::dynamic",
"module": "Sofa.Component.Topology.Container.Dynamic",
"include": "sofa/component/topology/container/dynamic/EdgeSetGeometryAlgorithms.h",
"doc": "Geometry algorithms dedicated to an edge topology.\n\nA class that provides geometry information on an EdgeSet.",
"inherits": [
"PointSetGeometryAlgorithms"
],
"templates": [
"sofa::defaulttype::Rigid2Types",
"sofa::defaulttype::Rigid3Types",
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "showEdgeIndices",
"type": "bool"
},
{
"name": "d_drawEdges",
"type": "bool"
},
{
"name": "_drawColor",
"type": "RGBAColor"
}
],
"links": [],
"methods": [
{
"name": "defineEdgeCubaturePoints",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "draw",
"return_type": "void",
"params": [
{
"name": "vparams",
"type": "const core::visual::VisualParams *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeEdgeLength",
"return_type": "Real",
"params": [
{
"name": "i",
"type": "const EdgeID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeEdgeLength",
"return_type": "void",
"params": [
{
"name": "ai",
"type": "BasicArrayInterface<Real> &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeRestEdgeLength",
"return_type": "Real",
"params": [
{
"name": "i",
"type": "const EdgeID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeRestSquareEdgeLength",
"return_type": "Real",
"params": [
{
"name": "i",
"type": "const EdgeID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeEdgeAABB",
"return_type": "void",
"params": [
{
"name": "i",
"type": "const EdgeID"
},
{
"name": "minCoord",
"type": "CPos &"
},
{
"name": "maxCoord",
"type": "CPos &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeEdgeCenter",
"return_type": "Coord",
"params": [
{
"name": "i",
"type": "const EdgeID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeEdgeDirection",
"return_type": "Coord",
"params": [
{
"name": "i",
"type": "const EdgeID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeRestEdgeDirection",
"return_type": "Coord",
"params": [
{
"name": "i",
"type": "const EdgeID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getEdgeVertexCoordinates",
"return_type": "void",
"params": [
{
"name": "i",
"type": "const EdgeID"
},
{
"name": "",
"type": "Coord[2]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getRestEdgeVertexCoordinates",
"return_type": "void",
"params": [
{
"name": "i",
"type": "const EdgeID"
},
{
"name": "",
"type": "Coord[2]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "isPointOnEdge",
"return_type": "bool",
"params": [
{
"name": "pt",
"type": "const sofa::type::Vec<3, Real> &"
},
{
"name": "ind_e",
"type": "const EdgeID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeEdgeBarycentricCoordinates",
"return_type": "int",
"params": [
{
"name": "p",
"type": "const sofa::type::Vec<3, Real> &"
},
{
"name": "ind_p1",
"type": "PointID"
},
{
"name": "ind_p2",
"type": "PointID"
},
{
"name": "useRestPosition",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computePointProjectionOnEdge",
"return_type": "int",
"params": [
{
"name": "i",
"type": "const EdgeID"
},
{
"name": "coord_x",
"type": "sofa::type::Vec<3, Real>"
},
{
"name": "intersected",
"type": "bool &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "compute2EdgesIntersection",
"return_type": "Coord",
"params": [
{
"name": "edge1",
"type": "const Coord[2]"
},
{
"name": "edge2",
"type": "const Coord[2]"
},
{
"name": "intersected",
"type": "bool &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeEdgeSegmentIntersection",
"return_type": "Coord",
"params": [
{
"name": "edgeID",
"type": "const EdgeID"
},
{
"name": "a",
"type": "const type::Vec3 &"
},
{
"name": "b",
"type": "const type::Vec3 &"
},
{
"name": "intersected",
"type": "bool &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeEdgePlaneIntersection",
"return_type": "bool",
"params": [
{
"name": "edgeID",
"type": "EdgeID"
},
{
"name": "pointOnPlane",
"type": "sofa::type::Vec<3, Real>"
},
{
"name": "normalOfPlane",
"type": "sofa::type::Vec<3, Real>"
},
{
"name": "intersection",
"type": "sofa::type::Vec<3, Real> &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeRestEdgePlaneIntersection",
"return_type": "bool",
"params": [
{
"name": "edgeID",
"type": "EdgeID"
},
{
"name": "pointOnPlane",
"type": "sofa::type::Vec<3, Real>"
},
{
"name": "normalOfPlane",
"type": "sofa::type::Vec<3, Real>"
},
{
"name": "intersection",
"type": "sofa::type::Vec<3, Real> &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeLocalFrameEdgeWeights",
"return_type": "void",
"params": [
{
"name": "numEdges",
"type": "int &"
},
{
"name": "edges",
"type": "int &"
},
{
"name": "weights",
"type": "int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "initPointAdded",
"return_type": "void",
"params": [
{
"name": "indice",
"type": "PointID"
},
{
"name": "ancestorElem",
"type": "const core::topology::PointAncestorElem &"
},
{
"name": "coordVecs",
"type": "const int &"
},
{
"name": "derivVecs",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getEdgeNumericalIntegrationDescriptor",
"return_type": "NumericalIntegrationDescriptor<Real, 1> &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "mustComputeBBox",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
}
]
},
"desc": {
"description": "The `EdgeSetGeometryAlgorithms` class in the SOFA framework provides geometry information specifically for an edge topology, inheriting from `PointSetGeometryAlgorithms`. This class is designed to handle geometric operations related to edges within a mesh. It supports various data types such as `Rigid2Types`, `Rigid3Types`, and `Vec3Types` through template specialization.\n\n### Role and Purpose:\nThe primary role of this component is to facilitate the computation of geometrical properties associated with edges, including edge lengths, directions, intersections, and projections. Additionally, it supports drawing edge indices and actual edges in a visualization context, enhancing debugging and visualization capabilities within SOFA simulations.\n\n### Interactions with Other Components:\n- **Topology Interaction**: It interacts closely with the topology of the mesh through methods that access edge data (`getEdgeVertexCoordinates`, `computeEdgeDirection`, etc.), requiring an underlying topology structure to be present.\n- **Drawing**: The `draw` method integrates with SOFA's visualization pipeline, enabling the rendering of edges and their indices using `core::visual::VisualParams`.\n- **Numerical Integration Points**: It manages cubature points for numerical integration on edges through methods like `defineEdgeCubaturePoints` and `getEdgeNumericalIntegrationDescriptor`, which are useful in finite element simulations involving edge elements.\n\n### Practical Usage Guidance:\nThe component provides various data fields such as `showEdgeIndices` (to display edge indices) and `_drawColor` (to set the color for drawing edges). The `computeLocalFrameEdgeWeights` method is particularly useful for computing deformation gradients at vertices, enabling more accurate simulations of deformable objects.\n\n### Data Fields:\n- **showEdgeIndices**: A boolean to enable or disable viewing edge indices during visualization.\n- **d_drawEdges**: A boolean to enable drawing edges in the topology.\n- **_drawColor**: An `RGBAColor` field for setting the color used to draw edges."
},
"maths": {
"maths": "# Mathematical and Physical Description of EdgeSetGeometryAlgorithms Component\n\n## Overview\nThe `EdgeSetGeometryAlgorithms` class in the SOFA framework provides a set of geometric algorithms specifically designed for edge-based topologies. These operations are crucial for various simulation tasks such as computing lengths, directions, intersections, and deformation gradients related to edges within a mesh.\n\n## Geometric Properties\n### Edge Lengths\nThe length of an edge is computed using the Euclidean distance between its two endpoints. Given vertices \\(v_1\\) and \\(v_2\\), the edge length \\(L\\) can be expressed as:\n\\[ L = || v_1 - v_2 || = \\\\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \\]\n\n### Edge Directions\nThe direction vector of an edge is computed by normalizing the difference between its endpoint coordinates. Given vertices \\(v_1\\) and \\(v_2\\), the direction vector \\(τ\\) can be expressed as:\n\\[ τ = \\\\frac{v_2 - v_1}{|| v_2 - v_1 ||} \\]\n\n### Barycentric Coordinates\nBarycentric coordinates are used to express a point in terms of the vertices of an edge. Given a point \\(P\\) and vertices \\(v_1\\) and \\(v_2\\), the barycentric coordinates \\(λ_1\\) and \\(λ_2\\) can be computed as:\n\\[ λ_1 = \\\\frac{|P - v_2|}{|v_1 - v_2|}, λ_2 = 1 - λ_1 \\]\n\n### Edge Intersection\nThe intersection of two edges can be computed by solving a system of linear equations. Given the parametric forms of the lines defined by the edges, the intersection point \\(P\\) is found where the parameters \\(τ\\) and \\(ς\\) satisfy:\n\\[ v_{11} + τ (v_{12} - v_{11}) = v_{21} + ς (v_{22} - v_{21}) \\]\nwhere \\(v_{ij}\\) represents the coordinates of vertices for edge i.\n\n## Physical Properties\n### Deformation Gradients and Local Frames\nThe deformation gradient at each vertex is computed using a pseudo-inverse approach. Given edges around a vertex, the weights are calculated to ensure that the weighted sum of the edge directions approximates an identity matrix. This allows the computation of rotated and deformed bases for each vertex during simulation.\n\nGiven edges \\(E\\) around a vertex, the weight vector \\(ω_i\\) is computed as:\n\\[ ω_i = V_t^i (V V_t)^{-1} I_3 \\]\nwhere \\(V\\) and \\(V_t\\) are matrices of edge directions, and \\(I_3\\) represents the identity matrix.\n\n### Integration Points\nNumerical integration points on edges are used to discretize integrals over the edge for finite element methods. These points are defined based on specific rules (e.g., Gaussian quadrature), enabling accurate computation of various physical quantities such as forces and stresses along the edge.\n\n## Visualization Support\nThe component supports visualization by providing options to display edge indices and draw edges in different colors, aiding in debugging and visual verification during simulations."
},
"summary": {
"abstract": "The `EdgeSetGeometryAlgorithms` class provides geometric operations for edges within a mesh, including length computation, direction calculation, intersections, and projections. It supports visualization by displaying edge indices and drawing edges in specified colors.",
"sheet": "# EdgeSetGeometryAlgorithms\n\n## Overview\nThe `EdgeSetGeometryAlgorithms` class is designed to handle geometric operations related to edges within a mesh topology. It inherits from `PointSetGeometryAlgorithms` and provides methods for computing edge lengths, directions, intersections, and projections. Additionally, it supports visualization by displaying edge indices and drawing edges in specified colors.\n\n## Parameters and Data\n- **showEdgeIndices**: A boolean to enable or disable viewing edge indices during visualization.\n- **d_drawEdges**: A boolean to enable drawing edges in the topology.\n- **_drawColor**: An `RGBAColor` field for setting the color used to draw edges.\n\n## Mathematical Model\n### Edge Lengths\nThe length of an edge is computed using the Euclidean distance between its two endpoints. Given vertices \\(v_1\\) and \\(v_2\\), the edge length \\(L\\) can be expressed as:\n\\[ L = || v_1 - v_2 || = \\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \\]\n\n### Edge Directions\nThe direction vector of an edge is computed by normalizing the difference between its endpoint coordinates. Given vertices \\(v_1\\) and \\(v_2\\), the direction vector \\(τ\\) can be expressed as:\n\\[ τ = \\frac{v_2 - v_1}{|| v_2 - v_1 ||} \\]\n\n### Barycentric Coordinates\nBarycentric coordinates are used to express a point in terms of the vertices of an edge. Given a point \\(P\\) and vertices \\(v_1\\) and \\(v_2\\), the barycentric coordinates \\(λ_1\\) and \\(λ_2\\) can be computed as:\n\\[ λ_1 = \\frac{|P - v_2|}{|v_1 - v_2|}, λ_2 = 1 - λ_1 \\]\n\n### Edge Intersection\nThe intersection of two edges can be computed by solving a system of linear equations. Given the parametric forms of the lines defined by the edges, the intersection point \\(P\\) is found where the parameters \\(τ\\) and \\(ς\\) satisfy:\n\\[ v_{11} + τ (v_{12} - v_{11}) = v_{21} + ς (v_{22} - v_{21}) \\]\nwhere \\(v_{ij}\\) represents the coordinates of vertices for edge i."
}
}