public CLineVM(DblPoint3 P1, DblPoint3 P2, ScaleTranslateTransform transform)
 {
     mP1 = P1;
       mP2 = P2;
       ApplyTransform(transform);
 }
 public void ApplyTransform(ScaleTranslateTransform transform)
 {
     mP1Transformed = transform.Apply(mP1);
       mP2Transformed = transform.Apply(mP2);
       Notify("");
 }
        private void CalculateTransform()
        {
            //Fitting of the world square inside the CuttingPlaneSize
              double worldWidth = 20000;
              double worldHeight = 20000;

              double scale;
              if (mCuttingPlaneSize.x / mCuttingPlaneSize.y > worldWidth / worldHeight)
            //The first dimension to hit the border is height, because cuttingplane has a wider aspect than world
            scale = mCuttingPlaneSize.y / worldHeight;
              else
            scale = mCuttingPlaneSize.x / worldWidth;

              var factor = GrblFirmware.DEFAULT_X_STEPS_PER_MM / GrblFirmware.DEFAULT_Y_STEPS_PER_MM;

              mWorldToCuttingPlaneTransform = new ScaleTranslateTransform(new DblPoint3(scale, -scale * factor, 1),
                                                                  new DblPoint3(mCuttingPlaneSize.x / 2,
                                                                                mCuttingPlaneSize.y / 2,
                                                                                0));
        }