I decided to create a Vector Class for my app in strict objective-C. The way i thought this could happen is to create a Point2D class first holding each point in a (x,y) format and then create a Vector2D class holding 2 points.
Where the whole thing got stuck is in my Vector2D class. Im trying to find a way to hold 2 objects (actually 2 x Point2D objects) in an instance variable in my Vector2D class.
I thought of an NSMutableArray but i recall many problems in this situation, plus im not sure is the most efficient solution since im dealing with floats.
What i would like is some sort of guidance through a Vector class for objective-c or your tips/recommendations on my “quest”.
How would you choose to do such a thing and also what would require extra attention.
C array of fixed size (2 in your case) should be perfectly acceptable in your situation. Since your vector does not grow dynamically, I think this should work just fine: