Example #1
0
 public function Transform()
 {
     if ($this->mTransformed) {
         return;
     }
     // 1. Scale
     // 2. Rotate
     // 3. Translate
     $transformation = ALiVE_Transformations_Combine($this->mScaling, $this->mRotation);
     $transformation = ALiVE_Transformations_Combine($transformation, $this->mTranslation);
     // OPTIMIZABLE: TODO: Change this to use only one ->Apply() call to a combined matrix
     //                    of all vectors-to-be-transformed
     foreach ($this->mPoints as $i => $point) {
         $this->mTransformedPoints[$i] = $transformation->Apply($point);
     }
     $this->mTransformed = true;
 }
Example #2
0
 protected function MakeMatrix()
 {
     $this->mRotation = new ALiVE_Rotation($this->mRotationVector->X(), $this->mRotationVector->Y(), $this->mRotationVector->Z());
     $this->mScaling = new ALiVE_Scaling($this->mScalingVector->X(), $this->mScalingVector->Y(), $this->mScalingVector->Z());
     $this->mTranslation = new ALiVE_Translation($this->mTranslationVector->X(), $this->mTranslationVector->Y(), $this->mTranslationVector->Z());
     $result = ALiVE_Transformations_Combine($this->mScaling, $this->mRotation, $this->mTranslation);
     $this->mMatrix = $result->ToMatrix();
 }