Translating/transforming? list of points from its center with an offset/distance

后端 未结 1 1181
悲&欢浪女
悲&欢浪女 2021-01-27 14:48

Well, I\'m currently trying to move a list of points using its center as reference with a desired offset. But I\'m having problems.

I have implemented the current functi

相关标签:
1条回答
  • 2021-01-27 15:19

    You need to use scales instead of translating a flat amount for every pixel, or it gets distorted like that.

    float avgMagnitude = points.Average(v => ((Vector2)v - pivot).magnitude);
    scale = (offset + avgMagnitude) / avgMagnitude;
    
    0 讨论(0)
提交回复
热议问题