namespace NT { /**
     * Represents the transformation of an object, providing position, rotation and scale.
     */ export class Transform { /** The position. Default: Vector3.zero */ public position : Vector3 = Vector3 . zero ; /** The rotation. Default: Vector3.zero */ public rotation : Vector3 = Vector3 . zero ; /** The rotation. Default: Vector3.one */ public scale : Vector3 = Vector3 . one ; param transform public copyFrom ( transform ) { this . position . copyFrom ( transform . position ) ; this . rotation . copyFrom ( transform . rotation ) ; this . scale . copyFrom ( transform . scale ) ; } /** Creates and returns a matrix based on this transform. */ public getTransformationMatrix ( ) { let translation = Matrix4x4 . translation ( this . position ) ; let rotation = Matrix4x4 . rotationXYZ ( this . rotation . x , this . rotation . y , this . rotation . z ) ; let scale = Matrix4x4 . scale ( this . scale ) ; return Matrix4x4 . multiply ( Matrix4x4 . multiply ( translation , rotation ) , scale ) ; } param json public setFromJson ( json ) { if ( json . position !== undefined ) { this . position . setFromJson ( json . position ) ; } if ( json . rotation !== undefined ) { this . rotation . setFromJson ( json . rotation ) ; } if ( json . scale !== undefined ) { this . scale . setFromJson ( json . scale ) ; } } } }