| Title: | Calculate Mass Properties and Uncertainties of Tree Structures |
|---|---|
| Description: | Recursively calculates mass properties (mass, center of mass, moments and products of inertia, and optionally, their uncertainties) for arbitrary decomposition trees. R. L. Zimmerman, J. H. Nakai. (2005) <https://www.sawe.org/product/paper-3360/>). |
| Authors: | James Steven Jenkins [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-0725-0884>) |
| Maintainer: | James Steven Jenkins <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.3.5 |
| Built: | 2026-05-13 08:48:57 UTC |
| Source: | https://github.com/jsjuni/massprops |
add_radii_of_gyration() adds calculated radii of gyration to a data frame
of rolled-up mass properties.
Radii of gyration are calculated directly from moments of inertia and mass; they are not recursively-defined, and do not require a rollup method.
add_radii_of_gyration(df)add_radii_of_gyration(df)
df |
A data frame with (at least) these columns: |
A data frame with the same columns as df, plus
radii of gyration in columns kx, ky, and kz.'
test_table_rollup <- rollup_mass_props(test_tree, test_table) add_radii_of_gyration(test_table_rollup)test_table_rollup <- rollup_mass_props(test_tree, test_table) add_radii_of_gyration(test_table_rollup)
combine_mass_props() calculates the mass properties of an aggregate from
a list of constituent mass properties.
combine_mass_props(mpl)combine_mass_props(mpl)
mpl |
A list of mass properties lists, each of which contains the following named elements:
|
See vignette("massProps", package = "massProps") for details on the algorithms employed.
Combined mass properties list with the same named elements.
leaves <- names(igraph::neighbors(test_tree, "A.3", mode = "in")) mpl <- Map(f = function(id) get_mass_props(test_table, id), leaves) combine_mass_props(mpl)leaves <- names(igraph::neighbors(test_tree, "A.3", mode = "in")) mpl <- Map(f = function(id) get_mass_props(test_table, id), leaves) combine_mass_props(mpl)
combine_mass_props_and_unc() is a convenience wrapper that concatenates the
results of combine_mass_props() and combine_mass_props_unc().
combine_mass_props_and_unc(mpl)combine_mass_props_and_unc(mpl)
mpl |
A list of mass properties and uncertainties lists, each of which contains the following named elements:
|
Combined mass properties list with the same named elements.
leaves <- names(igraph::neighbors(sawe_tree, "Combined", mode = "in")) mpl <- Map(f = function(id) get_mass_props_and_unc(sawe_table, id), leaves) combine_mass_props_and_unc(mpl)leaves <- names(igraph::neighbors(sawe_tree, "Combined", mode = "in")) mpl <- Map(f = function(id) get_mass_props_and_unc(sawe_table, id), leaves) combine_mass_props_and_unc(mpl)
combine_mass_prop_unc() calculates the mass properties uncertainties of an aggregate from
the mass properties and uncertainties of its constituents and the mass properties of the aggregate.
combine_mass_props_unc(mpl, amp)combine_mass_props_unc(mpl, amp)
mpl |
A list of mass properties and uncertainties lists, each of which contains the following named elements:
|
amp |
A named list of mass properties for the aggregate containing the following named elements:
|
See vignette("massProps", package = "massProps") for details on the algorithms employed.
The mass properties and uncertainties of the aggregate. A list with the same elements as
members of mpl.
leaves <- names(igraph::neighbors(sawe_tree, "Combined", mode = "in")) mpl <- Map(f = function(id) get_mass_props_and_unc(sawe_table, id), leaves) combine_mass_props_unc(mpl, amp = get_mass_props(sawe_table, "Combined"))leaves <- names(igraph::neighbors(sawe_tree, "Combined", mode = "in")) mpl <- Map(f = function(id) get_mass_props_and_unc(sawe_table, id), leaves) combine_mass_props_unc(mpl, amp = get_mass_props(sawe_table, "Combined"))
get_mass_props() creates a mass properties list from a selected row in a data frame.
get_mass_props(df, id)get_mass_props(df, id)
df |
A data frame with (at least) these columns: |
id |
The |
A list with the following named elements:
mass Numeric mass.
center_mass Numeric 3-vector center of mass.
point Logical indicating point mass. The inertia of point masses is excluded from calculations.
inertia Numeric 3x3 matrix inertia tensor. The signs of the off-diagonal elements of the inertia tensor
are determined by POIconv. For example, the element of the inertia
tensor is Ixy if POIconv is "-"; it is -Ixy if POIconv is "+".
get_mass_props(mp_table, "C.1.2.2.3.1.2.3")get_mass_props(mp_table, "C.1.2.2.3.1.2.3")
get_mass_props_and_unc() is a convenience wrapper that combines the results of
get_mass_props() and get_mass_props_unc().
get_mass_props_and_unc(df, id)get_mass_props_and_unc(df, id)
df |
A data frame with (at least) these columns: |
id |
The |
A list with the following named elements:
mass Numeric mass.
center_mass Numeric 3-vector center of mass.
point Logical indicating point mass. The inertia of point masses is excluded from calculations.
inertia Numeric 3x3 matrix inertia tensor. The signs of the off-diagonal elements of the inertia tensor
are determined by POIconv. For example, the element of the inertia
tensor is Ixy if POIconv is "-"; it is -Ixy if POIconv is "+".
sigma_mass Numeric mass uncertainty.
sigma_center_mass Numeric 3-vector center of mass uncertainties.
sigma_inertia Numeric 3x3 matrix inertia tensor uncertainties.
get_mass_props_and_unc(mp_table, "C.1.2.2.3.1.2.3")get_mass_props_and_unc(mp_table, "C.1.2.2.3.1.2.3")
get_mass_props_and_unc_and_radii() creates a mass properties and uncertainties
and radii of gyration list from a selected row in a data frame.
get_mass_props_and_unc_and_radii(df, id)get_mass_props_and_unc_and_radii(df, id)
df |
A data frame with (at least) these columns: |
id |
The |
A list with the following named elements:
mass Numeric mass.
center_mass Numeric 3-vector center of mass.
point Logical indicating point mass. The inertia of point masses is excluded from calculations.
inertia Numeric 3x3 matrix inertia tensor. The signs of the off-diagonal elements of the inertia tensor
are determined by POIconv. For example, the element of the inertia
tensor is Ixy if POIconv is "-"; it is -Ixy if POIconv is "+".
sigma_mass Numeric mass uncertainty.
sigma_center_mass Numeric 3-vector center of mass uncertainties.
sigma_inertia Numeric 3x3 matrix inertia tensor uncertainties.
radii_gyration Numeric 3-vector radii of gyration.
mp_table_small_rollup <- rollup_mass_props_and_unc(mp_tree_small, mp_table_small) radii_table_small <- add_radii_of_gyration(mp_table_small_rollup) get_mass_props_and_unc_and_radii(radii_table_small, "C.1")mp_table_small_rollup <- rollup_mass_props_and_unc(mp_tree_small, mp_table_small) radii_table_small <- add_radii_of_gyration(mp_table_small_rollup) get_mass_props_and_unc_and_radii(radii_table_small, "C.1")
get_mass_props_and_unc_and_radii_and_unc() creates a mass properties and uncertainties
and radii of gyration and uncertainties list from a selected row in a data frame.
get_mass_props_and_unc_and_radii_and_unc(df, id)get_mass_props_and_unc_and_radii_and_unc(df, id)
df |
A data frame with (at least) these columns: |
id |
The |
A list with the following named elements:
mass Numeric mass.
center_mass Numeric 3-vector center of mass.
point Logical indicating point mass. The inertia of point masses is excluded from calculations.
inertia Numeric 3x3 matrix inertia tensor. The signs of the off-diagonal elements of the inertia tensor
are determined by POIconv. For example, the element of the inertia
tensor is Ixy if POIconv is "-"; it is -Ixy if POIconv is "+".
sigma_mass Numeric mass uncertainty.
sigma_center_mass Numeric 3-vector center of mass uncertainties.
sigma_inertia Numeric 3x3 matrix inertia tensor uncertainties.
radii_gyration Numeric 3-vector radii of gyration.
sigma_radii_gyration Numeric 3-vector radii of gyration uncertainties.
mp_table_small_rollup <- rollup_mass_props_and_unc(mp_tree_small, mp_table_small) radii_and_unc_table <- rollup_radii_of_gyration_unc( mp_tree_small, add_radii_of_gyration(mp_table_small_rollup)) get_mass_props_and_unc_and_radii_and_unc(radii_and_unc_table, "C.1")mp_table_small_rollup <- rollup_mass_props_and_unc(mp_tree_small, mp_table_small) radii_and_unc_table <- rollup_radii_of_gyration_unc( mp_tree_small, add_radii_of_gyration(mp_table_small_rollup)) get_mass_props_and_unc_and_radii_and_unc(radii_and_unc_table, "C.1")
get_mass_props_unc() creates a mass properties uncertainties list from a selected row in a data frame.
get_mass_props_unc(df, id)get_mass_props_unc(df, id)
df |
A data frame with (at least) these columns: |
id |
The |
A list with the following named elements:
sigma_mass Numeric mass uncertainty.
sigma_center_mass Numeric 3-vector center of mass uncertainties.
sigma_inertia Numeric 3x3 matrix inertia tensor uncertainties.
get_mass_props_unc(mp_table, "C.1.2.2.3.1.2.3")get_mass_props_unc(mp_table, "C.1.2.2.3.1.2.3")
Example Mass Properties Table
mp_tablemp_table
A data frame with columns:
unique key
character name
sign convention for products of inertia (one of c("+", "-"))
mass
-component of center of mass
-component of center of mass
-component of center of mass
moment of inertia
moment of inertia
moment of inertia
product of inertia
product of inertia
product of inertia
logical indicator to consider item a point mass, i.e., with negligible inertia
mass uncertainty
-component of center of mass uncertainty
-component of center of mass uncertainty
-component of center of mass uncertainty
moment of inertia uncertainty
moment of inertia uncertainty
moment of inertia uncertainty
product of inertia uncertainty
product of inertia uncertainty
product of inertia uncertainty
Example Small Mass Properties Table
mp_table_smallmp_table_small
A data frame with columns:
unique key
character name
sign convention for products of inertia (one of c("+", "-"))
mass
-component of center of mass
-component of center of mass
-component of center of mass
moment of inertia
moment of inertia
moment of inertia
product of inertia
product of inertia
product of inertia
logical indicator to consider item a point mass, i.e., with negligible inertia
mass uncertainty
-component of center of mass uncertainty
-component of center of mass uncertainty
-component of center of mass uncertainty
moment of inertia uncertainty
moment of inertia uncertainty
moment of inertia uncertainty
product of inertia uncertainty
product of inertia uncertainty
product of inertia uncertainty
Example Mass Properties Tree
mp_treemp_tree
An 'igraph' tree whose vertices are named as the values of the id
column of a mass properties table and whose directed edges point from child
id to parent id.
Example Small Mass Properties Tree
mp_tree_smallmp_tree_small
An 'igraph' tree whose vertices are named as the values of the id
column of a mass properties table and whose directed edges point from child
id to parent id.
'rollup_mass_props()' rolls up mass properties in a data frame such that the mass properties of each non-leaf vertex element is the aggregation of those of its child elements.
rollup_mass_props(tree, df, validate_df = validate_mass_props_table, ...)rollup_mass_props(tree, df, validate_df = validate_mass_props_table, ...)
tree |
An 'igraph' tree whose vertices are named as the values of the |
df |
A data frame with (at least) these columns: |
validate_df |
A validator for the tree and table, default |
... |
Other parameters passed to |
The updated data frame
rollup_mass_props(mp_tree_small, mp_table_small)rollup_mass_props(mp_tree_small, mp_table_small)
'rollup_mass_props_and_unc()' rolls up mass properties in a data frame
with (at least) these columns: id, mass, Cx, Cy, Cz, Ixx, Iyy, Izz, Ixy,
Ixz, Iyz, POIconv, Ipoint, sigma_mass, sigma_Cx, sigma_Cy, sigma_Cz,
sigma_Ixx, sigma_Iyy, sigma_Izz, sigma_Ixy, sigma_Ixz, sigma_Iyz.
The difference between rollup_mass_props_unc() and rollup_mass_props_and_unc() is that rollup_mass_props_unc()
expects the mass properties in its input to have been rolled up, whereas rollup_mass_props_and_unc() performs
the mass properties rollup itself.
rollup_mass_props_and_unc( tree, df, validate_df = validate_mass_props_and_unc_table, ... )rollup_mass_props_and_unc( tree, df, validate_df = validate_mass_props_and_unc_table, ... )
tree |
An 'igraph' tree whose vertices are named as the values of the |
df |
A data frame with (at least) these columns: |
validate_df |
A validator for the tree and table, default |
... |
Other parameters passed to |
The updated data frame
rollup_mass_props_and_unc(mp_tree_small, mp_table_small)rollup_mass_props_and_unc(mp_tree_small, mp_table_small)
rollup_mass_props_and_unc_fast() performs the same operation as rollup_mass_props_and_unc()
but omits input validation. It is somewhat faster than rollup_mass_props_and_unc() but should
be used with caution and only under circumstances in which the caller assumes
responsibility for validity of input. Its behavior when passed ill-formed input is unspecified.
rollup_mass_props_and_unc_fast(tree, df)rollup_mass_props_and_unc_fast(tree, df)
tree |
An 'igraph' tree whose vertices are named as the values of the |
df |
A data frame with (at least) these columns: |
The updated data frame
rollup_mass_props_and_unc_fast(sawe_tree, sawe_table)rollup_mass_props_and_unc_fast(sawe_tree, sawe_table)
rollup_mass_props_fast() performs the same operation as rollup_mass_props()
but omits input validation. It is somewhat faster than rollup_mass_props() but should
be used with caution and only under circumstances in which the caller assumes
responsibility for validity of input. Its behavior when passed ill-formed input is unspecified.
rollup_mass_props_fast(tree, df)rollup_mass_props_fast(tree, df)
tree |
An 'igraph' tree whose vertices are named as the values of the |
df |
A data frame with (at least) these columns: |
The updated data frame
rollup_mass_props_fast(test_tree, test_table)rollup_mass_props_fast(test_tree, test_table)
rollup_mass_props_unc() rolls up mass properties uncertainties in a data frame such that the uncertainties of each
non-leaf vertex element is the aggregation of the mass properties and uncertainties of its child elements.
The difference between rollup_mass_props_unc() and rollup_mass_props_and_unc() is that rollup_mass_props_unc()
expects the mass properties in its input to have been rolled up, whereas rollup_mass_props_and_unc() performs
the mass properties rollup itself.
rollup_mass_props_unc( tree, df, validate_df = validate_mass_props_and_unc_table, ... )rollup_mass_props_unc( tree, df, validate_df = validate_mass_props_and_unc_table, ... )
tree |
An 'igraph' tree whose vertices are named as the values of the |
df |
A data frame with (at least) these columns: |
validate_df |
A validator for the tree and table, default |
... |
Other parameters passed to |
The updated data frame
mp_ru <- rollup_mass_props(mp_tree_small, mp_table_small) rollup_mass_props_unc(mp_tree_small, mp_ru)mp_ru <- rollup_mass_props(mp_tree_small, mp_table_small) rollup_mass_props_unc(mp_tree_small, mp_ru)
rollup_mass_props_unc_fast() performs the same operation as rollup_mass_props_unc()
but omits input validation. It is somewhat faster than rollup_mass_props_unc() but should
be used with caution and only under circumstances in which the caller assumes
responsibility for validity of input. Its behavior when passed ill-formed input is unspecified.
rollup_mass_props_unc_fast(tree, df)rollup_mass_props_unc_fast(tree, df)
tree |
An 'igraph' tree whose vertices are named as the values of the |
df |
A data frame with (at least) these columns: |
The updated data frame
rollup_mass_props_unc_fast(sawe_tree, sawe_table)rollup_mass_props_unc_fast(sawe_tree, sawe_table)
rollup_radii_of_gyration_unc() adds calculated radii of gyration uncertainties to a data frame
of rolled-up mass properties and uncertainties.
Radii of gyration uncertainties are calculated directly from moments of inertia and mass and their uncertainties; they are not recursively-defined. Radii of gyration uncertainties for composite elements depend on uncertainties of their component elements.
rollup_radii_of_gyration_unc(tree, df)rollup_radii_of_gyration_unc(tree, df)
tree |
An 'igraph' tree whose vertices are named as the values of the |
df |
A data frame with (at least) these columns: |
A data frame with the same columns as df, plus
radii of gyration in columns sigma_kx, sigma_ky, and sigma_kz.'
sawe_table_rollup <- rollup_mass_props(sawe_tree, sawe_table) rollup_radii_of_gyration_unc(sawe_tree, add_radii_of_gyration(sawe_table_rollup))sawe_table_rollup <- rollup_mass_props(sawe_tree, sawe_table) rollup_radii_of_gyration_unc(sawe_tree, add_radii_of_gyration(sawe_table_rollup))
Mass Properties and Uncertainties Table from SAWE Paper No. 3360
sawe_tablesawe_table
A data frame with columns:
unique key
mass
x component of center of mass
y component of center of mass
z component of center of mass
Ixx moment of inertia
Iyy moment of inertia
Izz moment of inertia
Ixy product of inertia
Ixz product of inertia
Iyz product of inertia
mass uncertainty
x component of center of mass uncertainty
y component of center of mass uncertainty
z component of center of mass uncertainty
Ixx moment of inertia uncertainty
Iyy moment of inertia uncertainty
Izz moment of inertia uncertainty
Ixy product of inertia uncertainty
Ixz product of inertia uncertainty
Iyz product of inertia uncertainty
logical indicator to consider item a point mass
sign convention for products of inertia (one of c("+", "-"))
Zimmerman, Robert L., and John H. Nakai. 2005. “Are You Sure? Uncertainty in Mass Properties Engineering.” In 64th Annual International Conference on Mass Properties Engineering, 123–60. Society of Allied Weight Engineers.
Note: the results for combined mass properties and uncertainties in the published example are accurate only within approximately 0.2%.
Mass Properties and Uncertainties Tree from SAWE Paper No. 3360
sawe_treesawe_tree
An igraph tree with edges from child id to parent id.
Zimmerman, Robert L., and John H. Nakai. 2005. “Are You Sure? Uncertainty in Mass Properties Engineering.” In 64th Annual International Conference on Mass Properties Engineering, 123–60. Society of Allied Weight Engineers.
set_mass_props() sets mass properties for a specified row in a data frame.
set_mass_props(df, id, mp)set_mass_props(df, id, mp)
df |
A data frame with an |
id |
The |
mp |
A list with the following named elements:
|
The updated data frame with columns id, mass, Cx,
Cy, Cz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz, POIconv, Ipoint.
df <- data.frame(id = c("C.1.2.2.3.1.2.3", "C.1.2.2.3.2.1.1")) mp <- get_mass_props(mp_table, "C.1.2.2.3.2.1.1") mp$poi_conv = "+" set_mass_props(df, "C.1.2.2.3.2.1.1", mp)df <- data.frame(id = c("C.1.2.2.3.1.2.3", "C.1.2.2.3.2.1.1")) mp <- get_mass_props(mp_table, "C.1.2.2.3.2.1.1") mp$poi_conv = "+" set_mass_props(df, "C.1.2.2.3.2.1.1", mp)
set_mass_props_and_unc() is a convenience wrapper that combines the results of
set_mass_props() and set_mass_props_unc().
set_mass_props_and_unc(df, id, mpu)set_mass_props_and_unc(df, id, mpu)
df |
A data frame with an |
id |
The |
mpu |
A list containing the following named elements:
|
The updated data frame.
mpu <- c(get_mass_props_and_unc(sawe_table, "Widget"), poi_conv = "+") set_mass_props_and_unc(sawe_table, "Combined", mpu)mpu <- c(get_mass_props_and_unc(sawe_table, "Widget"), poi_conv = "+") set_mass_props_and_unc(sawe_table, "Combined", mpu)
set_mass_props_unc() sets mass properties uncertainties for a
selected row in a data frame with an id column.
set_mass_props_unc(df, id, mpu)set_mass_props_unc(df, id, mpu)
df |
A data frame with an |
id |
The |
mpu |
A list with the following named elements:
|
The updated data frame.
set_mass_props_unc(sawe_table, "Combined", get_mass_props_unc(sawe_table, "Widget"))set_mass_props_unc(sawe_table, "Combined", get_mass_props_unc(sawe_table, "Widget"))
set_poi_conv_from_target() sets the products of inertia sign convention for a
mass properties list to that of a target item in a mass properties table. This convention
determines how products of inertia are saved to the data frame.
The signature of set_poi_conv_from_target() is such that it can be passed as an override argument
to update_mass_props() and update_mass_props_and_unc(), thus ensuring
that all calculated POI values follow the negative integral convention of the target item to which they are written.
set_poi_conv_from_target(df, target, mp)set_poi_conv_from_target(df, target, mp)
df |
A data frame with columns |
target |
The |
mp |
A mass properties list. |
The mass properties list with the named element poi_conv set to the
POIconv column of the target row in the data frame.
set_poi_conv_from_target(mp_table, "C.1.2.2.3.2.1", get_mass_props(mp_table, "C.1.2.2.3.2.1.1"))set_poi_conv_from_target(mp_table, "C.1.2.2.3.2.1", get_mass_props(mp_table, "C.1.2.2.3.2.1.1"))
set_poi_conv_minus() sets the products of inertia sign convention for a
mass properties list to "-". This convention determines how products of inertia are
saved to a data set.
The signature of set_poi_conv_minus() is such that it can be passed as an override argument
to update_mass_props() and update_mass_props_and_unc(), thus ensuring
that calculated POI values are saved using the negative integral convention.
set_poi_conv_minus(ds, target, mp)set_poi_conv_minus(ds, target, mp)
ds |
Ignored. |
target |
Ignored. |
mp |
A mass properties list. |
The mass properties list with the named element poi_conv set to "-"
set_poi_conv_minus(NULL, NULL, get_mass_props(mp_table, "C.1.2.2.3.2.1.1"))set_poi_conv_minus(NULL, NULL, get_mass_props(mp_table, "C.1.2.2.3.2.1.1"))
set_poi_conv_plus() sets the products of inertia sign convention for a
mass properties list to "+". This convention determines how products of inertia are
saved to a data set.
The signature of set_poi_conv_plus() is such that it can be passed as an override argument
to update_mass_props() and update_mass_props_and_unc(), thus ensuring
that calculated POI values are saved using the positive integral convention.
set_poi_conv_plus(ds, target, mp)set_poi_conv_plus(ds, target, mp)
ds |
Ignored. |
target |
Ignored. |
mp |
A mass properties list. |
The input mass properties list with the named element poi_conv set to "+"
set_poi_conv_plus(NULL, NULL, get_mass_props(mp_table, "C.1.2.2.3.2.1.1"))set_poi_conv_plus(NULL, NULL, get_mass_props(mp_table, "C.1.2.2.3.2.1.1"))
set_radii_of_gyration() sets radii of gyration for a
selected row in a data frame with an id column.
set_radii_of_gyration(df, id, rg)set_radii_of_gyration(df, id, rg)
df |
A data frame with an |
id |
The |
rg |
A list with the following named elements:
|
The updated data frame.
rgl <- list(radii_gyration = c(x = 1, y = 2, z = 3)) set_radii_of_gyration(mp_table, "C.1", rgl)[1:5, ]rgl <- list(radii_gyration = c(x = 1, y = 2, z = 3)) set_radii_of_gyration(mp_table, "C.1", rgl)[1:5, ]
set_radii_of_gyration_unc() sets radii of gyration uncertainties for a
selected row in a data frame with an id column.
set_radii_of_gyration_unc(df, id, rgu)set_radii_of_gyration_unc(df, id, rgu)
df |
A data frame with an |
id |
The |
rgu |
A list with the following named elements:
|
The updated data frame.
rgul <- list(sigma_radii_gyration = c(x = 1, y = 2, z = 3)) set_radii_of_gyration_unc(mp_table, "C.1", rgul)[1:5, ]rgul <- list(sigma_radii_gyration = c(x = 1, y = 2, z = 3)) set_radii_of_gyration_unc(mp_table, "C.1", rgul)[1:5, ]
Example Mass Properties Table
test_tabletest_table
A data frame with columns:
unique key
parent key
mass
x component of center of mass
y component of center of mass
z component of center of mass
Ixx moment of inertia
Iyy moment of inertia
Izz moment of inertia
Ixy product of inertia
Ixz product of inertia
Iyz product of inertia
sign convention for products of inertia (one of c("+", "-"))
logical indicator to consider item a point mass
Example Mass Properties Tree
test_treetest_tree
An igraph tree with edges from child id to parent id.
Example Mass Properties and Uncertainties Table
test_unc_tabletest_unc_table
A data frame with columns:
unique key
parent key
mass
x component of center of mass
y component of center of mass
z component of center of mass
Ixx moment of inertia
Iyy moment of inertia
Izz moment of inertia
Ixy product of inertia
Ixz product of inertia
Iyz product of inertia
sign convention for products of inertia (one of c("+", "-"))
logical indicator to consider item a point mass
mass uncertainty
x component of center of mass uncertainty
y component of center of mass uncertainty
z component of center of mass uncertainty
Ixx moment of inertia uncertainty
Iyy moment of inertia uncertainty
Izz moment of inertia uncertainty
Ixy product of inertia uncertainty
Ixz product of inertia uncertainty
Iyz product of inertia uncertainty
update_mass_props() updates mass properties for a specified target row from
specified source rows in a data frame.
update_mass_props(df, target, sources, override = set_poi_conv_from_target)update_mass_props(df, target, sources, override = set_poi_conv_from_target)
df |
A data frame with (at least) these columns: |
target |
The |
sources |
List of |
override |
An override function, called as override(df, target, value). The default override sets the POI sign convention
of a computed aggregate to the |
The updated data frame.
leaves <- names(igraph::neighbors(test_tree, "A.3", mode = "in")) update_mass_props(test_table, "A.3", leaves)leaves <- names(igraph::neighbors(test_tree, "A.3", mode = "in")) update_mass_props(test_table, "A.3", leaves)
update_mass_props_and_unc() updates mass properties and uncertainties
for a specified target row from
specified source rows in a data frame.
update_mass_props_and_unc( df, target, sources, override = set_poi_conv_from_target )update_mass_props_and_unc( df, target, sources, override = set_poi_conv_from_target )
df |
A data frame with (at least) these columns: |
target |
The |
sources |
List of |
override |
An override function, called as override(df, target, value). The default override sets the POI sign convention
of a computed aggregate to the |
The updated data frame.
leaves <- list("Widget", "2nd Part") update_mass_props_and_unc(sawe_table, "Combined", leaves)leaves <- list("Widget", "2nd Part") update_mass_props_and_unc(sawe_table, "Combined", leaves)
update_mass_props_unc() updates mass properties uncertainties
for a specified target row from
specified source rows in a data frame
with (at least) these columns: id, sigma_mass, sigma_Cx, sigma_Cy, sigma_Cz,
sigma_Ixx, sigma_Iyy, sigma_Izz, sigma_Ixy, sigma_Ixz, sigma_Iyz.
update_mass_props_unc(df, target, sources, override = set_poi_conv_from_target)update_mass_props_unc(df, target, sources, override = set_poi_conv_from_target)
df |
A data frame with (at least) these columns: |
target |
The |
sources |
List of |
override |
An override function, called as override(df, target, value). The default override sets the POI sign convention
of a computed aggregate to the |
The updated data frame.
leaves <- names(igraph::neighbors(sawe_tree, "Combined", mode = "in")) update_mass_props_unc(sawe_table, "Combined", leaves)leaves <- names(igraph::neighbors(sawe_tree, "Combined", mode = "in")) update_mass_props_unc(sawe_table, "Combined", leaves)
validate_mass_props() ensures that a mass properties list satisfies the following
constraints:
mass is non-missing and positive
center_mass is a 3-vector of non-missing numeric values
point is TRUE or FALSE
if point is FALSE:
inertia is positive definite
eigenvalues of inertia satisfy the triangle inequalities:
validate_mass_props(mp)validate_mass_props(mp)
mp |
Mass properties list containing the following named elements
|
TRUE if valid, stops otherwise
mp <- get_mass_props(test_table, "C.1") validate_mass_props(mp)mp <- get_mass_props(test_table, "C.1") validate_mass_props(mp)
validate_mass_props_and_unc() is a convenience wrapper that calculates the logical
conjunction of validate_mass_props() and validate_mass_props_unc().
validate_mass_props_and_unc(mpu)validate_mass_props_and_unc(mpu)
mpu |
Mass properties and uncertainties list containing the following named elements
|
TRUE if valid, stops otherwise
mpu <- get_mass_props_and_unc(sawe_table, "Widget") validate_mass_props_and_unc(mpu)mpu <- get_mass_props_and_unc(sawe_table, "Widget") validate_mass_props_and_unc(mpu)
validate_mass_props_and_unc() calls
validate_mass_props_table() and further applies the checks of
validate_mass_props_and_unc() to every row of the data frame corresponding
to a leaf vertex of the tree.
validate_mass_props_and_unc_table(tree, df)validate_mass_props_and_unc_table(tree, df)
tree |
An 'igraph' tree whose vertices are named as the values of the |
df |
A data frame with (at least) these columns: |
TRUE if valid, stops with an error otherwise
validate_mass_props_and_unc_table(mp_tree_small, mp_table_small)validate_mass_props_and_unc_table(mp_tree_small, mp_table_small)
validate_mass_props_table() checks that the names of vertices
in a tree and the id values of a data frame are identical. It further
applies the checks of validate_mass_props() to every row of the data
frame corresponding to a leaf vertex of the tree.
validate_mass_props_table() ensures that the id column of the table and the vertices
of the tree contain the same identifiers, and that the mass properties of every leaf element
of the table are valid.
validate_mass_props_table(tree, df)validate_mass_props_table(tree, df)
tree |
An 'igraph' tree whose vertices are named as the values of the |
df |
A data frame with (at least) these columns: |
TRUE if valid, stops with an error otherwise
validate_mass_props_table(mp_tree_small, mp_table_small)validate_mass_props_table(mp_tree_small, mp_table_small)
validate_mass_props_unc() ensures that a mass properties and uncertainties
list satisfies the following constraints:
sigma_mass is non-missing and non-negative
sigma_center_mass is a 3-vector of non-missing non-negative values
if point is FALSE, the sigma_inertia contains no missing or negative values
validate_mass_props_unc(mp)validate_mass_props_unc(mp)
mp |
Mass properties and uncertainties list containing the following named elements
|
TRUE if valid, stops otherwise
mp <- get_mass_props_and_unc(sawe_table, "Widget") validate_mass_props_unc(mp)mp <- get_mass_props_and_unc(sawe_table, "Widget") validate_mass_props_unc(mp)