Home > Articles > Programming > General Programming/Other Languages

  • Print
  • + Share This
This chapter is from the book

Challenge: Vector Angle

Your Vector structure should be able to report its angle in radians. Add a read-only, computed property to it called angle.

The angle of a vector can be expressed in Swift as:

    atan2(y, x)
  • + Share This
  • 🔖 Save To Your Account