Hello guys: I have to project many points before drawing them on a frame. my codes are blow:
-(Coordination*)xyWorldToDev:(Coordination*)pt isIphoneYAxis:(BOOL)isIphoneYAxis{
CGPoint tmpPoint=CGPointApplyAffineTransform(CGPointMake(pt.x,pt.y),worldToDevMatrix);
Coordination *resultPoint=[[[Coordination alloc]initWithXY:tmpPoint.x withY:(isIphoneYAxis)?(sscy-tmpPoint.y):tmpPoint.y]autorelease];
return resultPoint; }
-(Coordination*)xyDevTo3D:(Coordination*)cPt{
double x=0.0,y=0.0;
double divide=1+m_cView3DPara.v*cPt.y;
x=(m_cView3DPara.a*cPt.x+m_cView3DPara.b*cPt.y+m_cView3DPara.e)/divide;
y=(m_cView3DPara.d*cPt.y+m_cView3DPara.f)/divide;
return [[[Coordination alloc]initWithXY:x withY:sscy-y]autorelease];
}
-(Coordination*)transformWorldTo3D:(Coordination*)pt{
return [self xyDevTo3D:[self xyWorldToDev:pt isIphoneYAxis:NO]];
}
Therefore,the method "-(Coordination*)transformWorldTo3D:(Coordination*)pt " is called hundreds times because projecting.
But i found it is very very SLOW while calling transformWorldTo3D! Is there another way to accelerate it? Or using another framework which could caculate the projecting value faster?