
Re-anchor a stored shape or scatterer component along the x axis
Source:R/shape_manipulation.R
reanchor_shape.RdTranslate a shape or scatterer component so that its nose, center, or tail lies at a specified x position.
Arguments
- object
Shape or Scatterer object.
- anchor
Anchor location used to define the translation target.
noseis treated as the maximum stored x position andtailas the minimum.- at
Target x location (m).
- component
Optional component name for scatterers. Defaults to the primary geometry (
"body"for most scatterers and"shell"forESS).- containment
Containment policy used when a moved swimbladder or backbone is checked against its body:
"warn","error", or"ignore".
Examples
shape_obj <- prolate_spheroid(length_body = 0.04, radius_body = 0.004)
centered_shape <- reanchor_shape(shape_obj, anchor = "center", at = 0)
range(extract(centered_shape, c("position_matrix", "x")))
#> [1] -0.02 0.02