开发者

Vector2D class in android

Does android have a built-in class that represents 2D vector? I need to do some basic ope开发者_开发技巧rations on 2D vectors, such as:

  • Addition/Substraction
  • Dot product
  • Scalar multiplication
  • Normalization

I know I could write my own class, but it would be more elegant and faster if there was a built-in class.


I don't think one exists. I had a quick look when I needed it and didn't see one and did my own. In terms of speed you'd need to decide whether to represent the data as fixed point or floating point, which would depend on the architecture and what you were going to do with them.


PointF is the class with the basic functionality, but you need to add most of your methods yourself.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜