kaolin.physics.simplicits.SkinnedPhysicsPoints¶
API¶
- class kaolin.physics.simplicits.SkinnedPhysicsPoints(pts, yms, prs, rhos, appx_vol, skinning_weights, dwdx, renderable: SkinnedPointsProtocol = None, strict_checks=True)¶
Bases:
PhysicsPoints,SkinnedPhysicsPointsProtocol,TensorContainerBasePoints with skinning properties and material properties.
- pts¶
The skinned points, of shape \((N, 3)\) (in \(m\)).
- Type
- yms¶
The Young’s moduli of the points, of shape \((N,)\) (in \(kg/m/s^2\)).
- Type
- prs¶
The Poisson’s ratios of the points, of shape \((N,)\).
- Type
- rhos¶
The densities of the points, of shape \((N,)\) (in \(kg/m^3\)).
- Type
- appx_vol¶
The approximate volume of the object, of shape \((1,)\) (in \(m^3\)).
- Type
- skinning_weights¶
The skinning weights of the points, of shape \((N, \text{num_handles})\).
- Type
- dwdx¶
Jacobian of the skinning weight function w.r.t. rest positions, of shape \((N, \text{num_handles}, 3)\).
- Type
- renderable¶
The renderable points, of shape \((\text{num_renderable_pts}, 3)\).
- Type
- __init__(pts, yms, prs, rhos, appx_vol, skinning_weights, dwdx, renderable: SkinnedPointsProtocol = None, strict_checks=True)¶
Constructor for making minimal simulatable data object from points, material properties, and skinning weights.
- Parameters
pts (torch.Tensor) – Cubature points tensor of shape \((N, 3)\) representing the object’s geometry (in \(m\))
yms (Union[torch.Tensor, float]) – Young’s moduli defining material stiffness (in \(kg/m/s^2\)). Can be either: - A tensor of shape \((N,)\) for per-point values - A float value that will be applied to all points
prs (Union[torch.Tensor, float]) – Poisson’s ratios defining material compressibility. Can be either: - A tensor of shape \((N,)\) for per-point values - A float value that will be applied to all points
rhos (Union[torch.Tensor, float]) – Density defining material density (in \(kg/m^3\)). Can be either: - A tensor of shape \((N,)\) for per-point values - A float value that will be applied to all points
appx_vol (Union[torch.Tensor, float]) – Approximate volume (in \(m^3\)). Can be either: - A tensor of shape \((1,)\) - A float value
skinning_weights (torch.Tensor) – Skinning weights tensor of shape \((N, M)\) representing the object’s skinning weights
dwdx (torch.Tensor) – Jacobian of the skinning weight function w.r.t. rest positions, of shape \((N, M, 3)\). Used to build the sparse \(dF/dz\) matrix inside
SimulatedObject.renderable (SkinnedPoints, optional) – Skinned points used for rendering (e.g. Gaussian splat positions with their skinning weights). Defaults to None.
- classmethod assert_supported(attr)¶
Raises an exception if class does not support provided attribute name.
- check_other_attribute(attr, log_error=False)¶
Checks a non-tensor attribute validity; returns True if ok.
- check_sanity(log_error=True)¶
Validates that all tensor attributes are correct; implement abstract methods.
- check_tensor_attribute(attr, log_error=False)¶
Checks tensor attribute validity; returns True if valid.
- classmethod class_other_attributes()¶
Returns attribute names that are not PyTorch tensors or dicts thereof.
- classmethod class_tensor_attributes()¶
Returns attribute names that are PyTorch tensors or dicts thereof.
- cpu(attributes: Optional[Sequence[str]] = None)¶
Calls
cpuon all or selected tensor attributes; returns a shallow copy.
- cuda(device: Optional[Union[int, device, str]] = None, attributes: Optional[Sequence[str]] = None)¶
Calls
cudaon all or selected tensor attributes; returns a shallow copy.
- describe_attribute(attr, print_stats=False, detailed=False)¶
Outputs an informative string about an attribute; the same method used for all attributes in
to_string.
- detach(attributes: Optional[Sequence[str]] = None)¶
Detaches all or selected tensor attributes; returns a shallow copy.
- classmethod from_skinning_mod(pts, yms, prs, rhos, appx_vol, skinning_mod: SkinningModule, renderable_pts=None)¶
Constructor from a
SkinningModuleto be applied on the points.- Parameters
pts (torch.Tensor) – The points to be skinned, of shape \((N, 3)\) (in \(m\))
yms (torch.Tensor) – The Young’s moduli of the points, of shape \((N,)\) (in \(kg/m/s^2\)).
prs (torch.Tensor) – The Poisson’s ratios of the points, of shape \((N,)\).
rhos (torch.Tensor) – The densities of the points, of shape \((N,)\) (in \(kg/m^3\)).
appx_vol (torch.Tensor) – The approximate volume of the object, of shape \((1,)\) (in \(m^3\)).
skinning_mod (SkinningModule) – The SkinningModule to be used to compute the skinning weights.
renderable_pts (torch.Tensor, optional) – The renderable points, of shape \((\text{num_renderable_pts}, 3)\) (in \(m\)). Defaults to None.
- Returns
A SkinnedPhysicsPoints with skinning weights and dwdx baked from
skinning_mod.- Return type
- get_attributes(only_tensors=False)¶
Returns names of all attributes that are currently set to non-None value in this class instance.
- Parameters
only_tensors – if true, will only include tensor attributes
- Returns
list of string names
- Return type
(list)
- property num_handles¶
Number of skinning handles, including the implicit constant handle.
- subsample(num_pts=None, sample_indices=None)¶
Subsample into another SkinnedPhysicsPoints.
- Parameters
num_pts (int, optional) – Number of points to sample. Mutually exclusive with
sample_indices.sample_indices (torch.Tensor, optional) – Explicit indices to use for subsampling, of shape \((\text{num_pts},)\). Mutually exclusive with
num_pts.
- Returns
The subsampled SkinnedPhysicsPoints, of size \((\text{num_pts})\).
- Return type
- to(*args: Any, attributes: Optional[Sequence[str]] = None, **kwargs: Any)¶
Moves or casts tensors like
torch.Tensor.to()/torch.nn.Module.to().- Parameters
*args – forwarded to
tensor.to(*args)attributes (list of str, optional) – if set, only these tensor attributes are updated
**kwargs – forwarded to
tensor.to(**kwargs)
- Returns
shallow copy with converted tensors
- Return type
- to_string(print_stats=False, detailed=False)¶
Returns information about tensor attributes currently contained in the object.