示例#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);
        }