void scaleShape(GLfloat factor) {
GLint length = sizeof(point) / sizeof(point[0]);
for(GLint i = 0; i < length; ++i) {
point[i].fx = factor * (point[i].fx - kDestPoint.fx) + kDestPoint.fx;
point[i].fy = factor * (point[i].fy - kDestPoint.fy) + kDestPoint.fy;
}
}
void rotate(GLfloat fAngle) {
GLint length = sizeof(point) / sizeof(point[0]);
for(GLint i = 0; i < length; ++i) {
point[i].fx = point[i].fx * cos(fAngle) - point[i].fy * sin(fAngle);
point[i].fy = point[i].fx * sin(fAngle) + point[i].fy * cos(fAngle);
}
}
Opengl旋转-缩放
最新推荐文章于 2022-04-12 21:16:59 发布