@@ -504,6 +504,7 @@ impl RigidBodyMassProps {
504504
505505#[ cfg_attr( feature = "serde-serialize" , derive( Serialize , Deserialize ) ) ]
506506#[ derive( Clone , Debug , Copy , PartialEq ) ]
507+ #[ repr( C ) ]
507508/// The velocities of this rigid-body.
508509pub struct RigidBodyVelocity < T : ScalarType > {
509510 /// The linear velocity of the rigid-body.
@@ -593,6 +594,11 @@ impl RigidBodyVelocity<Real> {
593594 #[ inline]
594595 #[ cfg( feature = "dim2" ) ]
595596 pub fn as_vector ( & self ) -> & na:: Vector3 < Real > {
597+ // SAFETY : this is safe because :
598+ // - RigidBodyVelocity is repr(C)
599+ // - the vector types used are repr(C)
600+ // - the only non vector type is Real
601+ // - total size in Reals is 3
596602 unsafe { core:: mem:: transmute ( self ) }
597603 }
598604
@@ -602,6 +608,11 @@ impl RigidBodyVelocity<Real> {
602608 #[ inline]
603609 #[ cfg( feature = "dim2" ) ]
604610 pub fn as_vector_mut ( & mut self ) -> & mut na:: Vector3 < Real > {
611+ // SAFETY : this is safe because :
612+ // - RigidBodyVelocity is repr(C)
613+ // - the vector types used are repr(C)
614+ // - the only non vector type is Real
615+ // - total size in Reals is 3
605616 unsafe { core:: mem:: transmute ( self ) }
606617 }
607618
@@ -611,6 +622,11 @@ impl RigidBodyVelocity<Real> {
611622 #[ inline]
612623 #[ cfg( feature = "dim3" ) ]
613624 pub fn as_vector ( & self ) -> & na:: Vector6 < Real > {
625+ // SAFETY : this is safe because :
626+ // - RigidBodyVelocity is repr(C)
627+ // - the vector types used are repr(C)
628+ // - the only non vector type is Real
629+ // - total size in Reals is 6
614630 unsafe { core:: mem:: transmute ( self ) }
615631 }
616632
@@ -620,6 +636,11 @@ impl RigidBodyVelocity<Real> {
620636 #[ inline]
621637 #[ cfg( feature = "dim3" ) ]
622638 pub fn as_vector_mut ( & mut self ) -> & mut na:: Vector6 < Real > {
639+ // SAFETY : this is safe because :
640+ // - RigidBodyVelocity is repr(C)
641+ // - the vector types used are repr(C)
642+ // - the only non vector type is Real
643+ // - total size in Reals is 6
623644 unsafe { core:: mem:: transmute ( self ) }
624645 }
625646
0 commit comments