What's the easiest/fastest way to convert between vector_float2 and CGPoint* in Objective-C?
Does Apple provide any built-in functionality for this kind of type conversion? I noticed in 2-3 places in sample apps they just call CGPointMake() etc. to make the conversion
Is it possible to simply cast a CGPoint* to vector_float2 and vice versa? Is it safe to do so?
Update: obviously the solution is:
vector_float2 v = (vector_float2){(float)point.x, (float)point.y};
CGPoint p = CGPointMake(v.x, v.y);
But this is cumbersome if you need to do so frequently, and more so if there's a C array of either vector_float2*
or CGPoint*
. So I'm looking for already-existing solutions or very simple alternatives that I may be overlooking.