CubeTopology
The `CubeTopology` component in the SOFA framework represents the surface topology of a cube in 3D, encompassing points, edges, and quads. It inherits from `MeshTopology`, which is part of the `Sofa.Component.Topology.Container.Constant` module. This component manages the grid resolution along the x, y, and z axes using data fields such as `nx`, `ny`, and `nz`. Users can configure whether to include internal points (enabling one-to-one mapping with RegularGridTopology) and control corner point splitting for planar normals via the `internalPoints` and `splitNormals` fields, respectively. It interacts with other components through methods like `parse` and `init`, which are overridden from its base class. The `setSize` method is used to define the grid resolution in all three dimensions, while `updatePoints`, `updateEdges`, and `updateQuads` ensure that the topology remains consistent with these parameters. To use this component effectively: - Set the grid resolutions (`nx`, `ny`, `nz`) to determine the granularity of the cube's surface representation. - Optionally enable `internalPoints` for a one-to-one mapping scenario or `splitNormals` for planar normals at corners. - Utilize methods such as `setPos` and `getPoint` to manipulate and retrieve positions within the grid.
- abstract
- The `CubeTopology` component defines the surface topology of a cube in 3D, including points, edges, and quads, with configurable grid resolution along x, y, z axes.
- sheet
- # CubeTopology ## Overview The `CubeTopology` component represents the surface topology of a cube in three-dimensional space, encompassing points, edges, and quads. It inherits from `MeshTopology`, allowing users to specify grid resolutions (`nx`, `ny`, `nz`) along each axis. Users can also configure whether to include internal points for one-to-one mapping with `RegularGridTopology` and control corner point splitting for planar normals. ## Parameters and Data The significant data fields exposed by the component are: - **nx**: x grid resolution (`int`, default: not specified) - **ny**: y grid resolution (`int`, default: not specified) - **nz**: z grid resolution (`int`, default: not specified) - **internalPoints**: include internal points for one-to-one mapping with `RegularGridTopology` (`bool`, default: false) - **splitNormals**: split corner points to have planar normals (`bool`, default: false) - **min**: minimum coordinates of the cube (`Vec3`, default: not specified) - **max**: maximum coordinates of the cube (`Vec3`, default: not specified) ## Dependencies and Connections The `CubeTopology` component typically requires no external dependencies but interacts with other SOFA components through the scene graph, particularly those that depend on mesh topology for simulation purposes.
- description
- The `CubeTopology` component in the SOFA framework represents the surface topology of a cube in 3D, encompassing points, edges, and quads. It inherits from `MeshTopology`, which is part of the `Sofa.Component.Topology.Container.Constant` module. This component manages the grid resolution along the x, y, and z axes using data fields such as `nx`, `ny`, and `nz`. Users can configure whether to include internal points (enabling one-to-one mapping with RegularGridTopology) and control corner point splitting for planar normals via the `internalPoints` and `splitNormals` fields, respectively. It interacts with other components through methods like `parse` and `init`, which are overridden from its base class. The `setSize` method is used to define the grid resolution in all three dimensions, while `updatePoints`, `updateEdges`, and `updateQuads` ensure that the topology remains consistent with these parameters. To use this component effectively: - Set the grid resolutions (`nx`, `ny`, `nz`) to determine the granularity of the cube's surface representation. - Optionally enable `internalPoints` for a one-to-one mapping scenario or `splitNormals` for planar normals at corners. - Utilize methods such as `setPos` and `getPoint` to manipulate and retrieve positions within the grid.
- maths
- # Mathematical Description of CubeTopology Component ## Overview The `CubeTopology` component in the SOFA (Simulation Open Framework Architecture) framework is designed to represent the surface topology of a cube in three-dimensional space. It provides detailed control over the grid resolution along each axis and includes functionality for managing internal points and splitting corner normals for planar surfaces. ## Grid Resolution The component allows users to specify the grid resolution along the x, y, and z axes using parameters `nx`, `ny`, and `nz` respectively. These parameters determine the number of segments (or cells) that divide each dimension of the cube into a uniform grid. For instance: - If `nx = 5`, there will be 4 divisions along the x-axis. - If `ny = 6`, there will be 5 divisions along the y-axis. - If `nz = 7`, there will be 6 divisions along the z-axis. The total number of vertices (or grid points) in the cube can then be calculated as: \[ N_{ ext{vertices}} = nx imes ny imes nz \] ## Internal Points and Split Normals - **Internal Points**: When enabled, internal points are included within the grid. This ensures a one-to-one mapping with `RegularGridTopology`, which is useful for certain simulations requiring consistent point distribution. - **Split Normals**: By splitting corner points, the component ensures that normals at these points remain planar and aligned correctly along each face of the cube. ## Point Calculation The position of any point within the grid can be calculated using the following formula: \[ P(x, y, z) = P_0 + x imes \Delta_x + y imes \Delta_y + z imes \Delta_z \] where: - $P_0$ is the origin or starting point of the grid. - $\Delta_x$, $\Delta_y$, and $\Delta_z$ are the vectors representing the step sizes along each axis. These can be defined as: - $\Delta_x = \frac{dx}{nx - 1}$ - $\Delta_y = \frac{dy}{ny - 1}$ - $\Delta_z = \frac{dz}{nz - 1}$ ## Topology Update Methods - **updatePoints**: This method ensures that all points in the grid are correctly positioned based on the current resolution and origin. - **updateEdges**: Ensures that edges connecting adjacent vertices are correctly defined, maintaining the connectivity of the mesh. - **updateQuads**: Ensures that quadrilateral faces (quads) are correctly defined by identifying sets of four points that form each face. These quads represent the surface elements of the cube. ## Example: Grid Calculation Given a grid with: \[ nx = 3, \quad ny = 4, \quad nz = 5 \] The total number of vertices is: \[ N_{ ext{vertices}} = 3 imes 4 imes 5 = 60 \] For point calculation with a defined origin $P_0$ and step sizes $dx$, $dy$, $dz$: - The position of a point at (1,2,3) would be calculated as: \[ P(1,2,3) = P_0 + 1 imes \Delta_x + 2 imes \Delta_y + 3 imes \Delta_z \] where $\Delta_x$, $\Delta_y$, and $\Delta_z$ are the step sizes along each axis. ## Physical Implications The `CubeTopology` component is essential for simulating physical phenomena within a defined cubic domain. By providing fine control over grid resolution, it allows users to balance computational efficiency with simulation accuracy. The inclusion of internal points and split normals ensures that the surface representation remains geometrically accurate, which is critical for simulations involving contact forces or fluid dynamics.
{
"name": "CubeTopology",
"main": {
"name": "CubeTopology",
"namespace": "sofa::component::topology::container::constant",
"module": "Sofa.Component.Topology.Container.Constant",
"include": "sofa/component/topology/container/constant/CubeTopology.h",
"doc": "Surface topology of a cube in 3D (points, edges and quads).",
"inherits": [
"MeshTopology"
],
"templates": [],
"data_fields": [
{
"name": "d_nx",
"type": "int",
"xmlname": "nx",
"help": "x grid resolution"
},
{
"name": "d_ny",
"type": "int",
"xmlname": "ny",
"help": "y grid resolution"
},
{
"name": "d_nz",
"type": "int",
"xmlname": "nz",
"help": "z grid resolution"
},
{
"name": "d_internalPoints",
"type": "bool",
"xmlname": "internalPoints",
"help": "include internal points (allow a one-to-one mapping between points from RegularGridTopology and CubeTopology)"
},
{
"name": "d_splitNormals",
"type": "bool",
"xmlname": "splitNormals",
"help": "split corner points to have planar normals"
},
{
"name": "d_min",
"type": "Vec3",
"xmlname": "min",
"help": "Min"
},
{
"name": "d_max",
"type": "Vec3",
"xmlname": "max",
"help": "Max"
}
],
"links": [],
"methods": [
{
"name": "setSize",
"return_type": "void",
"params": [
{
"name": "nx",
"type": "int"
},
{
"name": "ny",
"type": "int"
},
{
"name": "nz",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "parse",
"return_type": "void",
"params": [
{
"name": "arg",
"type": "core::objectmodel::BaseObjectDescription *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getNx",
"return_type": "int",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getNy",
"return_type": "int",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getNz",
"return_type": "int",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setNx",
"return_type": "void",
"params": [
{
"name": "n",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setNy",
"return_type": "void",
"params": [
{
"name": "n",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setNz",
"return_type": "void",
"params": [
{
"name": "n",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "init",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "reinit",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "point",
"return_type": "int",
"params": [
{
"name": "x",
"type": "int"
},
{
"name": "y",
"type": "int"
},
{
"name": "z",
"type": "int"
},
{
"name": "p",
"type": "Plane"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setP0",
"return_type": "void",
"params": [
{
"name": "val",
"type": "const Vec3 &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setDx",
"return_type": "void",
"params": [
{
"name": "val",
"type": "const Vec3 &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setDy",
"return_type": "void",
"params": [
{
"name": "val",
"type": "const Vec3 &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setDz",
"return_type": "void",
"params": [
{
"name": "val",
"type": "const Vec3 &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setPos",
"return_type": "void",
"params": [
{
"name": "xmin",
"type": "SReal"
},
{
"name": "xmax",
"type": "SReal"
},
{
"name": "ymin",
"type": "SReal"
},
{
"name": "ymax",
"type": "SReal"
},
{
"name": "zmin",
"type": "SReal"
},
{
"name": "zmax",
"type": "SReal"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getP0",
"return_type": "const Vec3 &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getDx",
"return_type": "const Vec3 &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getDy",
"return_type": "const Vec3 &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getDz",
"return_type": "const Vec3 &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getMin",
"return_type": "Vec3",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getMax",
"return_type": "Vec3",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPoint",
"return_type": "Vec3",
"params": [
{
"name": "i",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPoint",
"return_type": "Vec3",
"params": [
{
"name": "x",
"type": "int"
},
{
"name": "y",
"type": "int"
},
{
"name": "z",
"type": "int"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "hasPos",
"return_type": "bool",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPX",
"return_type": "SReal",
"params": [
{
"name": "i",
"type": "Index"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPY",
"return_type": "SReal",
"params": [
{
"name": "i",
"type": "Index"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPZ",
"return_type": "SReal",
"params": [
{
"name": "i",
"type": "Index"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setSplitNormals",
"return_type": "void",
"params": [
{
"name": "b",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setSize",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "updatePoints",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "updateEdges",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "updateQuads",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
}
]
},
"desc": {
"description": "The `CubeTopology` component in the SOFA framework represents the surface topology of a cube in 3D, encompassing points, edges, and quads. It inherits from `MeshTopology`, which is part of the `Sofa.Component.Topology.Container.Constant` module. This component manages the grid resolution along the x, y, and z axes using data fields such as `nx`, `ny`, and `nz`. Users can configure whether to include internal points (enabling one-to-one mapping with RegularGridTopology) and control corner point splitting for planar normals via the `internalPoints` and `splitNormals` fields, respectively.\n\nIt interacts with other components through methods like `parse` and `init`, which are overridden from its base class. The `setSize` method is used to define the grid resolution in all three dimensions, while `updatePoints`, `updateEdges`, and `updateQuads` ensure that the topology remains consistent with these parameters.\n\nTo use this component effectively:\n- Set the grid resolutions (`nx`, `ny`, `nz`) to determine the granularity of the cube's surface representation.\n- Optionally enable `internalPoints` for a one-to-one mapping scenario or `splitNormals` for planar normals at corners.\n- Utilize methods such as `setPos` and `getPoint` to manipulate and retrieve positions within the grid."
},
"maths": {
"maths": "# Mathematical Description of CubeTopology Component\n\n## Overview\nThe `CubeTopology` component in the SOFA (Simulation Open Framework Architecture) framework is designed to represent the surface topology of a cube in three-dimensional space. It provides detailed control over the grid resolution along each axis and includes functionality for managing internal points and splitting corner normals for planar surfaces.\n\n## Grid Resolution\nThe component allows users to specify the grid resolution along the x, y, and z axes using parameters `nx`, `ny`, and `nz` respectively. These parameters determine the number of segments (or cells) that divide each dimension of the cube into a uniform grid. For instance:\n- If `nx = 5`, there will be 4 divisions along the x-axis.\n- If `ny = 6`, there will be 5 divisions along the y-axis.\n- If `nz = 7`, there will be 6 divisions along the z-axis.\n\nThe total number of vertices (or grid points) in the cube can then be calculated as:\n\\[\nN_{\text{vertices}} = nx \times ny \times nz\n\\]\n\n## Internal Points and Split Normals\n- **Internal Points**: When enabled, internal points are included within the grid. This ensures a one-to-one mapping with `RegularGridTopology`, which is useful for certain simulations requiring consistent point distribution.\n- **Split Normals**: By splitting corner points, the component ensures that normals at these points remain planar and aligned correctly along each face of the cube.\n\n## Point Calculation\nThe position of any point within the grid can be calculated using the following formula:\n\\[\nP(x, y, z) = P_0 + x \times \\Delta_x + y \times \\Delta_y + z \times \\Delta_z\n\\]\nwhere:\n- $P_0$ is the origin or starting point of the grid.\n- $\\Delta_x$, $\\Delta_y$, and $\\Delta_z$ are the vectors representing the step sizes along each axis. These can be defined as:\n - $\\Delta_x = \\frac{dx}{nx - 1}$\n - $\\Delta_y = \\frac{dy}{ny - 1}$\n - $\\Delta_z = \\frac{dz}{nz - 1}$\n\n## Topology Update Methods\n- **updatePoints**: This method ensures that all points in the grid are correctly positioned based on the current resolution and origin.\n- **updateEdges**: Ensures that edges connecting adjacent vertices are correctly defined, maintaining the connectivity of the mesh.\n- **updateQuads**: Ensures that quadrilateral faces (quads) are correctly defined by identifying sets of four points that form each face. These quads represent the surface elements of the cube.\n\n## Example: Grid Calculation\nGiven a grid with:\n\\[\nnx = 3, \\quad ny = 4, \\quad nz = 5\n\\]\nThe total number of vertices is:\n\\[\nN_{\text{vertices}} = 3 \times 4 \times 5 = 60\n\\]\nFor point calculation with a defined origin $P_0$ and step sizes $dx$, $dy$, $dz$:\n- The position of a point at (1,2,3) would be calculated as:\n \\[\nP(1,2,3) = P_0 + 1 \times \\Delta_x + 2 \times \\Delta_y + 3 \times \\Delta_z\n\\]\nwhere $\\Delta_x$, $\\Delta_y$, and $\\Delta_z$ are the step sizes along each axis.\n\n## Physical Implications\nThe `CubeTopology` component is essential for simulating physical phenomena within a defined cubic domain. By providing fine control over grid resolution, it allows users to balance computational efficiency with simulation accuracy. The inclusion of internal points and split normals ensures that the surface representation remains geometrically accurate, which is critical for simulations involving contact forces or fluid dynamics."
},
"summary": {
"abstract": "The `CubeTopology` component defines the surface topology of a cube in 3D, including points, edges, and quads, with configurable grid resolution along x, y, z axes.",
"sheet": "# CubeTopology\n\n## Overview\nThe `CubeTopology` component represents the surface topology of a cube in three-dimensional space, encompassing points, edges, and quads. It inherits from `MeshTopology`, allowing users to specify grid resolutions (`nx`, `ny`, `nz`) along each axis. Users can also configure whether to include internal points for one-to-one mapping with `RegularGridTopology` and control corner point splitting for planar normals.\n\n## Parameters and Data\nThe significant data fields exposed by the component are:\n- **nx**: x grid resolution (`int`, default: not specified)\n- **ny**: y grid resolution (`int`, default: not specified)\n- **nz**: z grid resolution (`int`, default: not specified)\n- **internalPoints**: include internal points for one-to-one mapping with `RegularGridTopology` (`bool`, default: false)\n- **splitNormals**: split corner points to have planar normals (`bool`, default: false)\n- **min**: minimum coordinates of the cube (`Vec3`, default: not specified)\n- **max**: maximum coordinates of the cube (`Vec3`, default: not specified)\n\n## Dependencies and Connections\nThe `CubeTopology` component typically requires no external dependencies but interacts with other SOFA components through the scene graph, particularly those that depend on mesh topology for simulation purposes.\n"
}
}