开发者

comparing 2 bezierpaths?

i see the function CGPathEqualToPath which i successfully used to compare data from 2 UIbezierPaths (technically, i compared a path to itself).

Is there any way to modify this function to find out how开发者_StackOverflow similar 2 paths are? and perhaps make a threshold to say, ok, these paths are close enough to be considered the same?

(i'm using iOS)

also, unrelated. i have a mutable array of bezierpaths. what is the notation for accessing a particular element of the array? i'm new to this. thanks


You might be able to accomplish the comparison by drawing each path into a separate bitmap and then seeing how many bits they have in common. You could make a ratio of the total bits in both bitmaps to the bits in both bitmaps to get a degree of similarity. 2:1 would be identical (two bitmaps completely overlapping), 2:0 would mean nothing in common.


I don't think you can create a likeness function as you don't have access to the underlying structure or functions that provide access to those values. If you can elaborate the use case, maybe there is an alternate solution.

As for accessing an object at a particular index in an array, you can do it using –

id myObject = [array objectAtIndex:particularIndex];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜