# How can I rotate an elliptical cloud of points?

I have a function that draws on a texture in an airbrush style by picking a point using Random.insideUnitCircle, multiplying by the desired radius, and drawing the pixel. This runs several times in a loop.

If I want to distort this circle of points into an ellipse, I can multiply the x and y by different amounts.

Now, is there an easy way to rotate this ellipse of potential points forty-five degrees?

Pretty sure there is a quick solution to this; maybe some sort of matrix manipulation?

http://en.wikipedia.org/wiki/Rotation_matrix

Unity has just a Matrix4x4 but you can easily extend your Vectors to four dimensions.

Personally I’m fond of using a transform to make Unity do all the math stuff:

``````var points = [Vector2(0, 10), Vector2(5, 5)];
transform.position = Vector3.zero;
transform.eulerAngles = Vector3.forward * -45;
var matrix = transform.localToWorldMatrix;
for (point in points) point = matrix.MultiplyPoint3x4(point);
``````