Skip to content

JohnReeze/3DtoCamera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

3DtoCamera

Drawing a pyramid using pure Core Graphics in Swift 3.0

Result

1234

Algorithm

It is necessary to calculate the coordinates of all verteces in the world coordinate system and then in the camera coordinate system. In order to do that, we need to multiply all 3 rotation matrices and the result matrix should be used for all verteces. New coordinates will be used for drawing. Z-coordinate will be used just for determination the distance from camera to the facet. And X,Y- coordinates for usual drawing in Cartesian coordinate system.

Another aspect is the calculation of the light intensity for each facet. Just calculate angle between the normal vectors and the light vector.

About

Drawing a pyramid using pure Core Graphics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages