protected override void ImageMouseDown(int x0, int y0, MouseButtons buttons) { base.ImageMouseDown(x0, y0, buttons); _mouseDownOrigin = Origin; _mouseDownRotMat = RotMat; _mouseDownInvMat = _mouseDownRotMat.Inverse(); }
public static void WriteSingle3x3(this XmlElement rootElement, string name, Single3x3 value) { XmlElement element = rootElement.GetOrCreateElement(name); element.WriteSingle(_XXId, value.XX); element.WriteSingle(_XYId, value.XY); element.WriteSingle(_XZId, value.XZ); element.WriteSingle(_YXId, value.YX); element.WriteSingle(_YYId, value.YY); element.WriteSingle(_YZId, value.YZ); element.WriteSingle(_ZXId, value.ZX); element.WriteSingle(_ZYId, value.ZY); element.WriteSingle(_ZZId, value.ZZ); }
protected void PictureRotating(int x0, int y0, int dx, int dy) { int x1 = x0 + dx; int y1 = y0 + dy; double w2 = pictureBox.Width / 2d; double h2 = pictureBox.Height / 2d; double dx1 = ToDouble(x1 - w2); double dy1 = ToDouble(y1 - h2); double dx0 = ToDouble(x0 - w2); double dy0 = ToDouble(y0 - h2); double wh = Min(w2, h2); double a = (Atan(dx1 / wh) - Atan(dx0 / wh)).ToDegrees(); double b = (Atan(dy1 / wh) - Atan(dy0 / wh)).ToDegrees(); Single3x3 RotZ = new Single3x3(new Single3(0f, 0f, 1f), ToSingle(a)); Single3x3 RotX = new Single3x3(new Single3(1f, 0f, 0f), ToSingle(b)); RotMat = RotX * (RotZ * _mouseDownRotMat); }
public void SwapTopBottom() { RotMat = new Single3x3(1, 0, 0, 0, 1, 0, 0, 0, -1) * RotMat; }
public void SwapFrontRear() { RotMat = new Single3x3(1, 0, 0, 0, -1, 0, 0, 0, 1) * RotMat; }
public void SwapLeftRight() { RotMat = new Single3x3(-1, 0, 0, 0, 1, 0, 0, 0, 1) * RotMat; }
private void SetRotMat(Single3x3 value) { _rotMat = value.Orthogonalize(new Single3x3(1)); RefreshImage(); RotMatChanged?.Invoke(this, new EventArgs()); }
public static Single3x3 ReadSingle3x3(this XmlElement rootElement, string name, Single3x3 defaultValue) { XmlElement element = rootElement.GetOrCreateElement(name); float xx = element.ReadSingle(_XXId, defaultValue.XX); float xy = element.ReadSingle(_XYId, defaultValue.XY); float xz = element.ReadSingle(_XZId, defaultValue.XZ); float yx = element.ReadSingle(_YXId, defaultValue.YX); float yy = element.ReadSingle(_YYId, defaultValue.YY); float yz = element.ReadSingle(_YZId, defaultValue.YZ); float zx = element.ReadSingle(_ZXId, defaultValue.ZX); float zy = element.ReadSingle(_ZYId, defaultValue.ZY); float zz = element.ReadSingle(_ZZId, defaultValue.ZZ); return(new Single3x3(xx, xy, xz, yx, yy, yz, zx, zy, zz)); }