Advertisement
prz-emo

Untitled

Feb 1st, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. Point Point::transform(Matrix const& m, int Type) const
  2. {
  3. Coordinates c = {getX(), getY(), getZ(), 1};
  4. Coordinates beforeNorm = Coordinates(multiply(m, multiply(Shape::rotateZ, multiply(Shape::rotateY, (multiply(Shape::rotateX, multiply(Shape::centerMatrix3D, c)))))));
  5. if (Type == ProjectionType::PERSPECTIVE) {
  6. beforeNorm[0] = (beforeNorm[0] * 10.) / (beforeNorm[2] + 10.);
  7. beforeNorm[1] = (beforeNorm[1] * 10.) / (beforeNorm[2] + 10.);
  8. beforeNorm[2] = 0;
  9. beforeNorm[3] = 1;
  10. }
  11.  
  12. return Point(multiply(Shape::centerMatrix2D, beforeNorm));
  13. //return Point(multiply(Shape::centerMatrix, c));
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement