开发者

iPhone coordinate system slope-intercept of two points

I have 2 points in a UIView, but I am unable to get the correct line equation between these two points 开发者_如何学运维because UIView coordinate system is not cartesian. When I apply the cartesian slope of a line, I keep getting the wrong slope for the UIView coordinate system. Maybe I'm applying the identity matrix incorrectly or using the wrong identity matrix. Do I need to translate the point-slope form equation too? I'm not sure. Any help would be greatly appreciated.


Are you getting the wrong slope because the CG coordinate system is flipped/mirrored upside-down between the iPhone and Mac OS? If so then just change dy to -dy in your slope equation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜