Skip to main content

Force

Inherits from: object A class to represent 3D force. Represents force in 3D space with x, y, and z components. Supports mathematical operations and conversions to/from various formats. Attributes: x (float): x-component of force (N) y (float): y-component of force (N) z (float): z-component of force (N)

init

Force.__init__(x: float, y: float, z: float) -> None
Initialize a Force object.
Arguments
x (float)
float
required
x-component of force in Newtons
y (float)
float
required
y-component of force in Newtons
z (float)
float
required
z-component of force in Newtons
Returns
returns
None

to_dict

Force.to_dict() -> dict
Serialize to dictionary for JSON transfer.
Returns
dict
dict
Dictionary representation of the force

from_dict

Force.from_dict(data: dict) -> 'Force'
Deserialize from dictionary.
Arguments
data (dict)
dict
required
Dictionary containing force data
Returns
Force
'Force'
Reconstructed force object