public static CylPosition Transform(CylPosition cylPosition, Transform3D transform)
 {
     return(new CylPosition(
                transform.transform(cylPosition.XYZ),
                HalfAxis.ToHalfAxis(
                    transform.transformRot(HalfAxis.ToVector3D(cylPosition.Direction))
                    )
                ));
 }
Beispiel #2
0
 public Cylinder(uint pickId, CylinderProperties cylProperties, CylPosition cylPosition)
 {
     _pickId = pickId;
     _radiusOuter = cylProperties.RadiusOuter;
     _radiusInner = cylProperties.RadiusInner;
     _height = cylProperties.Height;
     _colorTop = cylProperties.ColorTop;
     _colorWallOuter = cylProperties.ColorWallOuter;
     _colorWallInner = cylProperties.ColorWallInner;
     _cylPosition = cylPosition;
 }
Beispiel #3
0
        public BBox3D BBoxOffset(Vector3D offset)
        {
            var bb = BBox3D.Initial;

            foreach (var cp in Positions)
            {
                CylPosition cpOffset = cp + offset;
                bb.Extend(cpOffset.BBox(CylRadius, CylLength));
            }
            return(bb);
        }
Beispiel #4
0
        public bool IntersectWithContent(CylPosition cylPosition)
        {
            Vector3D cylDirection = HalfAxis.ToVector3D(cylPosition.Direction);

            foreach (CylPosition c in Positions)
            {
                Vector3D vDiff     = c.XYZ - cylPosition.XYZ;
                double   axisProj  = Vector3D.DotProduct(cylDirection, vDiff);
                Vector3D vDiffProj = vDiff - axisProj * cylDirection;
                if (axisProj < CylLength && vDiffProj.GetLength() < CylRadius)
                {
                    return(true);
                }
            }
            return(false);
        }
        public void AddPosition(CylLoad load, CylPosition pos)
        {
            Matrix4D matRot = Matrix4D.Identity;
            Vector3D vTranslation = Vector3D.Zero;

            if (_swapped)
            {
                matRot = new Matrix4D(
                    0.0, -1.0, 0.0, 0.0
                    , 1.0, 0.0, 0.0, 0.0
                    , 0.0, 0.0, 1.0, 0.0
                    , 0.0, 0.0, 0.0, 1.0
                    );
                vTranslation = new Vector3D(load.PalletLength, 0.0, 0.0);

                matRot.M14 = vTranslation[0];
                matRot.M24 = vTranslation[1];
                matRot.M34 = vTranslation[2];
            }

            load.Add(pos.Transform(new Transform3D(matRot)));
        }
 public static CylPosition Transform(CylPosition cylPosition, Transform3D transform)
 {
     return new CylPosition(
         transform.transform(cylPosition._vPosition),
         HalfAxis.ToHalfAxis(
             transform.transformRot(HalfAxis.ToVector3D(cylPosition._axis))
             )
         );
 }
Beispiel #7
0
        public bool IsValidPosition(CylPosition cylPosition)
        {
            switch (cylPosition.Direction)
            {
            case HalfAxis.HAxis.AXIS_X_N:
                if (cylPosition.XYZ.X - CylLength < 0.0)
                {
                    return(false);
                }
                if (cylPosition.XYZ.X > StackingLength)
                {
                    return(false);
                }
                if (cylPosition.XYZ.Y - CylRadius < 0.0)
                {
                    return(false);
                }
                if (cylPosition.XYZ.Y + CylRadius > StackingWidth)
                {
                    return(false);
                }
                break;

            case HalfAxis.HAxis.AXIS_X_P:
                if (cylPosition.XYZ.X < 0.0)
                {
                    return(false);
                }
                if (cylPosition.XYZ.X - CylLength > StackingLength)
                {
                    return(false);
                }
                if (cylPosition.XYZ.Y - CylRadius < 0.0)
                {
                    return(false);
                }
                if (cylPosition.XYZ.Y + CylRadius > StackingWidth)
                {
                    return(false);
                }
                break;

            case HalfAxis.HAxis.AXIS_Y_N:
                if (cylPosition.XYZ.Y - CylLength < 0)
                {
                    return(false);
                }
                if (cylPosition.XYZ.Y > StackingWidth)
                {
                    return(false);
                }
                if (cylPosition.XYZ.X - CylRadius < 0)
                {
                    return(false);
                }
                if (cylPosition.XYZ.X + CylRadius > StackingLength)
                {
                    return(false);
                }
                break;

            case HalfAxis.HAxis.AXIS_Y_P:
                if (cylPosition.XYZ.Y < 0)
                {
                    return(false);
                }
                if (cylPosition.XYZ.Y + CylLength > StackingWidth)
                {
                    return(false);
                }
                if (cylPosition.XYZ.X - CylRadius < 0)
                {
                    return(false);
                }
                if (cylPosition.XYZ.X + CylRadius > StackingLength)
                {
                    return(false);
                }
                break;

            default:
                return(false);
            }
            return(true);
        }