/// <summary> /// Supports concentration gradients. /// </summary> /// <param name="DropletPrintStyleModel"></param> public DropletModel(DropletPrintStyleModel DropletPrintStyleModel) { _interpolateDistance = DropletPrintStyleModel.InterpolateDistance; _gradientShape = DropletPrintStyleModel.GradientShape; _gradientScaling = DropletPrintStyleModel.GradientScaling; Point3D point1 = new Point3D(DropletPrintStyleModel.X1, DropletPrintStyleModel.Y1, DropletPrintStyleModel.Z1); Point3D point2 = new Point3D(DropletPrintStyleModel.X2, DropletPrintStyleModel.Y2, DropletPrintStyleModel.Z2); Point3D point3 = new Point3D(DropletPrintStyleModel.X3, DropletPrintStyleModel.Y3, DropletPrintStyleModel.Z3); switch (DropletPrintStyleModel.GradientShape) { case GradientShape.None: _gradientModel = null; break; case GradientShape.Point: _gradientModel = new PointModel(_gradientScaling, DropletPrintStyleModel.PercentPerMm, point1); break; case GradientShape.Line: _gradientModel = new LineModel(_gradientScaling, DropletPrintStyleModel.PercentPerMm, point1, point2); break; case GradientShape.Plane: _gradientModel = new PlaneModel(_gradientScaling, DropletPrintStyleModel.PercentPerMm, point1, point2, point3); break; } }
/// <summary> /// Takes three 3D points and generates a Plane. /// </summary> /// <param name="Point1"></param> /// <param name="Point2"></param> /// <param name="Point3"></param> public PlaneModel(GradientScaling GradientScaling, double RateOfChange, Point3D Point1, Point3D Point2, Point3D Point3) : base(GradientScaling, RateOfChange) { _point1 = Point1; _point2 = Point2; _point3 = Point3; Vector3D vector1 = Point3D.Subtract(_point2, _point1); Vector3D vector2 = Point3D.Subtract(_point2, _point3); _normalVector = Vector3D.CrossProduct(vector1, vector2); _normalVector.Normalize(); _a = _normalVector.X; _b = _normalVector.Y; _c = _normalVector.Z; _d = -1 * (A * _point1.X + B * _point2.X + C * _point3.X); }
/// <summary> /// Takes 2 points to create a line. /// </summary> /// <param name="Point1"></param> /// <param name="Point2"></param> public LineModel(GradientScaling GradientScaling, double RateOfChange, Point3D Point1, Point3D Point2) : base(GradientScaling, RateOfChange) { _linePoint1 = Point1; _linePoint2 = Point2; _line = Point3D.Subtract(_linePoint2, _linePoint1); }
/// <summary> /// Generate a 3D point from a set of three 1D coordinates. /// </summary> /// <param name="Point"></param> public PointModel(GradientScaling GradientScaling, double RateOfChange, Point3D Point) : base(GradientScaling, RateOfChange) { _point = Point; }
public GradientModel(GradientScaling GradientScaling, double RateOfChange) { _gradientScaling = GradientScaling; _rateOfChange = RateOfChange; _rateOfChangePercent = _rateOfChange / 100; }