Ejemplo n.º 1
0
        public bool IsIntersectingWith(PositionedCylinder _positionedCylinder, out Exception _exception)
        {
            _exception = null;


            Polygon _polygonToCheckFront = _positionedCylinder.GetCylinderFrontView();
            Polygon _polygonToCheckSide  = _positionedCylinder.GetCylinderSideView();
            Polygon _polygonThisFront    = this.GetCylinderFrontView();
            Polygon _polygonThisSide     = this.GetCylinderSideView();

            if ((_polygonToCheckFront.IntersectsWith(_polygonThisFront)) &&
                (_polygonToCheckSide.IntersectsWith(_polygonThisSide)))
            {
                _exception = new ValidationException("Two or more cylinders intersect physically.");
                return(true);
            }

            if (_positionedCylinder.Offset_mm < this.Offset_mm + _positionedCylinder.CrankThrow.CrankPinWidth_mm)
            {
                double _double1 = Mathematics.GetAbsoluteAngle_deg(_positionedCylinder.GetAbsoluteCrankThrowRotation_deg(0), true);
                double _double2 = Mathematics.GetAbsoluteAngle_deg(this.GetAbsoluteCrankThrowRotation_deg(0), true);

                //če imata ročici isti kot, potem gre za t.a. "articulated" connecting rod
                if (_double1 != _double2)
                {
                    _exception = new ValidationException("Two or more connecting rods intersect physically.");
                    return(true);
                }
            }


            return(false);
        }
Ejemplo n.º 2
0
        public bool IsMatedWith(PositionedCylinder _positionedCylinder)
        {
            if (_positionedCylinder.offset_mm == this.offset_mm)
            {
                return(true);
            }
            else if (_positionedCylinder.offset_mm > this.offset_mm)
            {
                //če je njegov offset največ ta offset + ta pin width
                if (_positionedCylinder.Offset_mm <= this.offset_mm + this.CrankThrow.CrankPinWidth_mm)
                {
                    return(true);
                }
            }
            else //(_positionedCylinder.offset_mm < this.offset_mm)
            {
                //če je njegov offset največ ta offset - ta pin width
                if (_positionedCylinder.Offset_mm >= this.offset_mm - this.CrankThrow.CrankPinWidth_mm)
                {
                    return(true);
                }
            }


            return(false);
        }
Ejemplo n.º 3
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if ((destinationType == typeof(System.String)) &&
                (value is PositionedCylinder))
            {
                PositionedCylinder _positionedCylinder = (PositionedCylinder)value;
                return(_positionedCylinder.ToString());
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Ejemplo n.º 4
0
        public override bool Equals(object obj)
        {
            if (obj is PositionedCylinder)
            {
                PositionedCylinder _positionedCylinder = (PositionedCylinder)obj;

                if (this.guid.ToString() == _positionedCylinder.guid.ToString())
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(base.Equals(obj));
        }