Exemple #1
0
 /// <summary>
 /// Returns the <a href="https://en.wikipedia.org/wiki/Cross_product">Cross Product</a>
 /// of specified Vectors (Points).
 /// </summary>
 /// <param name="p1"></param>
 /// <param name="p2"></param>
 /// <returns></returns>
 public static V2GPoint CrossProduct(V2GPoint p1, V2GPoint p2)
 {
     return(new V2GPoint(
                p1.Y * p2.Z - p1.Z * p2.Y,
                p1.Z * p2.X - p1.X * p2.Z,
                p1.X * p2.Y - p1.Y * p2.X));
 }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="position"></param>
 /// <param name="speed"></param>
 /// <param name="materialAmount"></param>
 /// <param name="head"></param>
 /// <param name="mixPercentage"></param>
 public V2GPrintPosition(V2GPoint position, double speed, double materialAmount, int head, double mixPercentage)
 {
     this.Position       = position;
     this.Speed          = speed;
     this.MaterialAmount = materialAmount;
     this.Head           = head;
     this.MixPercentage  = mixPercentage;
 }
 public void AddPrintPosition(V2GPoint position, double speed, double materialAmount, int head, double mixPercentage)
 {
     this.Speed          = speed;
     this.MaterialAmount = materialAmount;
     this.Head           = head;
     this.MixPercentage  = mixPercentage;
     this.PrintPositions.Add(new V2GPrintPosition(position, speed, materialAmount, head, mixPercentage));
 }
Exemple #4
0
 /// <summary>
 /// Returns the distance of this PrintPoint to another.
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public double DistanceTo(V2GPoint p)
 {
     return(Math.Sqrt(
                (this.X - p.X) * (this.X - p.X) +
                (this.Y - p.Y) * (this.Y - p.Y) +
                (this.Z - p.Z) * (this.Z - p.Z)
                ));
 }
Exemple #5
0
        /// <summary>
        /// Calculate voxel point properties.
        /// </summary>
        /// <param name="_Voxel"></param>
        public void SetPropertiesWith(VoxelImage _Voxel)
        {
            double delta = 0.000001;

            VoxelImage   v  = _Voxel as VoxelImage;
            VoxelChannel vc = v.GetChannel(VoxelImageLayout.SHAPECHANNEL) as VoxelChannel;

            V2GPoint x0 = this.Position - V2GPoint.XAxis * delta;
            V2GPoint x1 = this.Position + V2GPoint.XAxis * delta;
            V2GPoint y0 = this.Position - V2GPoint.YAxis * delta;
            V2GPoint y1 = this.Position + V2GPoint.YAxis * delta;
            V2GPoint z0 = this.Position - V2GPoint.ZAxis * delta;
            V2GPoint z1 = this.Position + V2GPoint.ZAxis * delta;

            double x = V2GVoxel.GetVoxelFieldValue(vc, x1) - V2GVoxel.GetVoxelFieldValue(vc, x0);
            double y = V2GVoxel.GetVoxelFieldValue(vc, y1) - V2GVoxel.GetVoxelFieldValue(vc, y0);
            double z = V2GVoxel.GetVoxelFieldValue(vc, z1) - V2GVoxel.GetVoxelFieldValue(vc, z0);

            V2GPoint UnitVector = new V2GPoint(x, y, z);

            UnitVector.Normalize();

            double   fieldValue = V2GVoxel.GetVoxelFieldValue(vc, this.Position);
            V2GPoint RealVector = UnitVector * fieldValue;

            V2GPoint UnitVectorProjected = new V2GPoint(RealVector.X, RealVector.Y, 0);
            V2GPoint UnitVectorPerpendicularProjected = V2GPoint.CrossProduct(UnitVectorProjected, V2GPoint.ZAxis);

            UnitVectorProjected.Normalize();
            UnitVectorPerpendicularProjected.Normalize();

            this.ContourVector3d = UnitVector;
            this.ContourVector   = UnitVectorPerpendicularProjected;
            this.GradientVector  = UnitVectorProjected;
            this.FieldValue      = fieldValue;
        }
Exemple #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="position"></param>
 public V2GPrintPosition(V2GPoint position)
 {
     this.X = position.X;
     this.Y = position.Y;
     this.Z = position.Z;
 }
Exemple #7
0
 /// <summary>
 /// Substract the coordinates of specified V2GPoint to this one.
 /// </summary>
 /// <param name="p"></param>
 public void Substract(V2GPoint p)
 {
     this.X += -p.X;
     this.Y += -p.Y;
     this.Z += -p.Z;
 }
Exemple #8
0
 /// <summary>
 /// Add the coordinates of specified V2GPoint to this one.
 /// </summary>
 /// <param name="p"></param>
 public void Add(V2GPoint p)
 {
     this.X += p.X;
     this.Y += p.Y;
     this.Z += p.Z;
 }
Exemple #9
0
 public V2GLine(V2GPoint startPoint, V2GPoint endPoint)
 {
     this.StartPoint = startPoint;
     this.EndPoint   = endPoint;
 }
 public void AddPrintPosition(V2GPoint position)
 {
     this.PrintPositions.Add(new V2GPrintPosition(position));
 }
Exemple #11
0
 /// <summary>
 /// Creates a shallow copy of the specified Point.
 /// </summary>
 /// <param name="p"></param>
 public V2GPoint(V2GPoint p)
 {
     this.X = p.X;
     this.Y = p.Y;
     this.Z = p.Z;
 }
Exemple #12
0
 /// <summary>
 /// A V2GPoint with voxel metadata.
 /// </summary>
 /// <param name="_Voxel"></param>
 /// <param name="_Point"></param>
 public V2GVoxelPoint(VoxelImage _Voxel, V2GPoint _Point)
 {
     this.Position = _Point;
     this.SetPropertiesWith(_Voxel);
 }