/// <summary>
 /// Overrides <see cref="CADability.GeoObject.ISurfaceImpl.SameGeometry (BoundingRect, ISurface, BoundingRect, double, out ModOp2D)"/>
 /// </summary>
 /// <param name="thisBounds"></param>
 /// <param name="other"></param>
 /// <param name="otherBounds"></param>
 /// <param name="precision"></param>
 /// <param name="firstToSecond"></param>
 /// <returns></returns>
 public override bool SameGeometry(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds, double precision, out ModOp2D firstToSecond)
 {
     if (other is SurfaceOfLinearExtrusion)
     {
         firstToSecond = ModOp2D.Null;
         SurfaceOfLinearExtrusion sleother = other as SurfaceOfLinearExtrusion;
         // es würde genügen, wenn die beiden Kurven sich überlappen. Dann auf das Überlappungsintervall testen
         bool reverse;
         if (!Curves.SameGeometry(BasisCurve, sleother.BasisCurve, precision, out reverse))
         {
             return(false);
         }
         // zwei Extrempunkte bestimmen, damit sollte es OK sein
         GeoPoint2D uv1 = new GeoPoint2D(curveStartParameter, 0.0);
         GeoPoint   p1  = PointAt(uv1);
         GeoPoint2D uv2 = sleother.PositionOf(p1);
         GeoPoint   p2  = sleother.PointAt(uv2);
         if ((p1 | p2) > precision)
         {
             return(false);
         }
         uv1 = new GeoPoint2D(curveEndParameter, 1.0);
         p1  = PointAt(uv1);
         uv2 = sleother.PositionOf(p1);
         p2  = sleother.PointAt(uv2);
         if ((p1 | p2) > precision)
         {
             return(false);
         }
         firstToSecond = ModOp2D.Translate(uv2 - uv1);
         return(true);
     }
     return(base.SameGeometry(thisBounds, other, otherBounds, precision, out firstToSecond));
 }
示例#2
0
 public PlanePolygon(GeoPoint2D uv, GeoPoint loc, GeoVector diru, GeoVector dirv, GeoPoint edgeStart, GeoPoint edgeEnd, Tangulation tangulation)
 {
     // TODO: Complete member initialization
     plane   = new Plane(loc, diru, dirv);
     toUV    = ModOp2D.Translate(uv.x, uv.y) * ModOp2D.Fit(new GeoVector2D[] { GeoVector2D.XAxis, GeoVector2D.YAxis }, new GeoVector2D[] { plane.Project(diru), plane.Project(dirv) });
     polygon = new List <GeoPoint2D>();
     polygon.Add(plane.Project(edgeStart)); // die beiden Punkte geben die Linie an, die die Ebene begrenzt
     polygon.Add(plane.Project(edgeEnd));
     isOpen = true;                         // die Linie "halbiert" die Ebene, links davon ist innerhalb
     extend = BoundingCube.EmptyBoundingCube;
 }
示例#3
0
        public InfiniteLine2D(GeoPoint2D startPoint, GeoPoint2D endPoint)
        {
            this.startPoint = startPoint;
            direction       = endPoint - startPoint;
            Angle a = direction.Angle;

            if (Precision.IsEqual(a, Angle.A0) || Precision.IsEqual(a, Angle.A180))
            {
                toXAxis = ModOp2D.Translate(0.0, -startPoint.y);
            }
            else
            {
                double l = -startPoint.y / direction.y; // != 0.0, da nicht horizontal
                double x = startPoint.x + l * direction.x;
                // double y = startPoint.y+l*direction.y;
                toXAxis = ModOp2D.Rotate(new GeoPoint2D(x, 0.0), new SweepAngle(-a));
            }
        }
示例#4
0
 /// <summary>
 /// Overrides <see cref="CADability.GeoObject.ISurfaceImpl.SameGeometry (BoundingRect, ISurface, BoundingRect, double, out ModOp2D)"/>
 /// </summary>
 /// <param name="thisBounds"></param>
 /// <param name="other"></param>
 /// <param name="otherBounds"></param>
 /// <param name="precision"></param>
 /// <param name="firstToSecond"></param>
 /// <returns></returns>
 public override bool SameGeometry(BoundingRect thisBounds, ISurface other, BoundingRect otherBounds, double precision, out ModOp2D firstToSecond)
 {
     if (other is HelicalSurface)
     {
         firstToSecond = ModOp2D.Null;
         HelicalSurface srother = other as HelicalSurface;
         bool           reverse;
         if (!Curves.SameGeometry(BasisCurve, srother.BasisCurve, precision, out reverse))
         {
             return(false);
         }
         if ((Location | srother.Location) > precision)
         {
             return(false);
         }
         if (Math.Abs(pitch - srother.pitch) > precision)
         {
             return(false);
         }
         GeoPoint2D uv1 = new GeoPoint2D(curveStartParameter, 0.0);
         GeoPoint   p1  = PointAt(uv1);
         GeoPoint2D uv2 = srother.PositionOf(p1);
         GeoPoint   p2  = srother.PointAt(uv2);
         if ((p1 | p2) > precision)
         {
             return(false);
         }
         uv1 = new GeoPoint2D(curveEndParameter, 0.0);
         p1  = PointAt(uv1);
         uv2 = srother.PositionOf(p1);
         p2  = srother.PointAt(uv2);
         if ((p1 | p2) > precision)
         {
             return(false);
         }
         firstToSecond = ModOp2D.Translate(uv2 - uv1);
         return(true);
     }
     return(base.SameGeometry(thisBounds, other, otherBounds, precision, out firstToSecond));
 }
示例#5
0
        /// <summary>
        /// Clips the bitmap according to the provided shape and plane. The BitmapBits are replaced by
        /// transparent pixels, the original bits are lost. Setting another clip area doesn't restore already clipped
        /// pixels. (Ofcourse undo restores the original bitmap bits)
        /// </summary>
        /// <param name="plane">The plane as a reference system for the shape</param>
        /// <param name="shape">The shape for the clip operation</param>
        public void Clip(Plane plane, CompoundShape shape)
        {
#if !WEBASSEMBLY
            Plane         pln  = new Plane(location, directionWidth, directionHeight);
            CompoundShape prsh = shape.Project(plane, pln);
            ModOp2D       m    = ModOp2D.Scale(bitmap.Width / directionWidth.Length, -bitmap.Height / directionHeight.Length);
            prsh = prsh.GetModified(m);
            m    = ModOp2D.Translate(0, bitmap.Height);
            prsh = prsh.GetModified(m);
            GraphicsPath gp = prsh.CreateGraphicsPath();
            using (new Changing(this))
            {
                Region   rg       = new Region(gp);
                Bitmap   clone    = bitmap.Clone() as Bitmap;
                Graphics graphics = Graphics.FromImage(bitmap);
                graphics.Clear(Color.FromArgb(0, 0, 0, 0));
                graphics.SetClip(rg, CombineMode.Replace);
                graphics.DrawImage(clone, new System.Drawing.Point(0, 0));
                graphics.Dispose();
            }
#endif
        }
示例#6
0
 public override void Move(double x, double y)
 {
     ClearTriangulation();
     fromUnit = ModOp2D.Translate(x, y) * fromUnit;
 }
示例#7
0
 public override ModOp2D ReverseOrientation()
 {
     boxedSurfaceEx = null;
     along.Reverse();
     return(ModOp2D.Translate(1, 0) * ModOp2D.Scale(-1, 1));
 }