void DrawPv3D() { cub = new YLScsDrawing.Drawing3d.Cuboid(100, 200, 10); cam = new YLScsDrawing.Drawing3d.Camera(); cub.Center = new YLScsDrawing.Drawing3d.Point3d(400, 240, 0); cam.Location = new YLScsDrawing.Drawing3d.Point3d(400, 240, -500); cubeX = (int)(pvPanelAngle1.tiltAngle * -1) - 90; cubeY = (int)pvPanelCompassCtl1.AzimutAngle; cubeZ = 0;// (int)pvPanelAxisRotationCtl1.AxisAngle; labelCrX.Text = cubeX.ToString(); labelCrY.Text = cubeY.ToString(); labelCrZ.Text = cubeZ.ToString(); YLScsDrawing.Drawing3d.Quaternion q = new YLScsDrawing.Drawing3d.Quaternion(); q.FromAxisAngle(new YLScsDrawing.Drawing3d.Vector3d(1, 0, 0), cubeX * Math.PI / 180.0); cub.RotateAt(cub.Center, q); q.FromAxisAngle(new YLScsDrawing.Drawing3d.Vector3d(0, 1, 0), cubeY * Math.PI / 180.0); cub.RotateAt(cub.Center, q); q.FromAxisAngle(new YLScsDrawing.Drawing3d.Vector3d(0, 0, 1), cubeZ * Math.PI / 180.0); cub.RotateAt(cub.Center, q); if (chkShowTexture.Checked == true) { texture(); } Invalidate(); }
private void button7_Click(object sender, EventArgs e) { cubeZ -= 5; labelCrZ.Text = cubeZ.ToString(); YLScsDrawing.Drawing3d.Quaternion q = new YLScsDrawing.Drawing3d.Quaternion(); q.FromAxisAngle(new YLScsDrawing.Drawing3d.Vector3d(0, 0, 1), -5 * Math.PI / 180.0); cub.RotateAt(cub.Center, q); Invalidate(); }