libgdx shaperender旋转如何找到旋转矩形的开始、结束X、Y坐标?

libgdx shaperender旋转如何找到旋转矩形的开始、结束X、Y坐标?,libgdx,Libgdx,我有个问题。我可以将一个矩形旋转一定角度,但是通过这个旋转,开始的X和Y坐标没有改变矩形,只是改变了矩形上的视图。那么,在旋转过程中,如何才能找到旋转矩形的旋转开始、结束X和Y坐标(很抱歉,这句话中的旋转太多了:P) 我希望任何人都能帮助我 谢谢 /** @param x the x of the rectangle * @param y the y of the rectangle * @param width the width of the rectangle * @param

我有个问题。我可以将一个矩形旋转一定角度,但是通过这个旋转,开始的X和Y坐标没有改变矩形,只是改变了矩形上的视图。那么,在旋转过程中,如何才能找到旋转矩形的旋转开始、结束X和Y坐标(很抱歉,这句话中的旋转太多了:P)

我希望任何人都能帮助我

谢谢

/** @param x the x of the rectangle
 *  @param y the y of the rectangle
 *  @param width the width of the rectangle
 *  @param height the height of the rectangle
 *  @param radians the desired rotation of the rectangle (in radians)
 *  @param output The array to store the results in. A new one will be created if it is null or its length is less than 8.
 *  @return the given output array with the rotated vertices as in [x1, y1, x2, y2, x3, y3, x4, y4] starting from the given offset */
public static float[] rotate(float x, float y, float width, float height, float radians, float[] output, int offset) {
    if(output == null || offset + 8 > output.length - 1)
        output = new float[8];
    // http://www.monkeycoder.co.nz/Community/posts.php?topic=3935
    float rad = (float) (Math.sqrt(height * height + width * width) / 2.);
    float theta = com.badlogic.gdx.math.MathUtils.atan2(height, width);
    float x0 = (float) (rad * Math.cos(theta + radians));
    float y0 = (float) (rad * Math.sin(theta + radians));
    float x1 = (float) (rad * Math.cos(-theta + radians));
    float y1 = (float) (rad * Math.sin(-theta + radians));
    float offsetX = x + width / 2, offsetY = y + height / 2;
    output[offset] = offsetX + x0;
    output[offset + 1] = offsetY + y0;
    output[offset + 2] = offsetX + x1;
    output[offset + 3] = offsetY + y1;
    output[offset + 4] = offsetX - x0;
    output[offset + 5] = offsetY - y0;
    output[offset + 6] = offsetX - x1;
    output[offset + 7] = offsetY - y1;
    return output;
}