コード例 #1
0
ファイル: SleevePart.cs プロジェクト: vicente-da-silva/YCYR
        public override void BuildPart(Vector2 start)
        {
            base.BuildPart(start);

            SleeveMaker calcResult = new SleeveMaker(start, Measurements);

            calcResult.CalcSleeveForShoulderCirc();

            System.Diagnostics.Debug.WriteLine("SleeveMaker [Before Adjustment] Sleeve Length=" + calcResult.SleeveHeightCalculated + " Arm Length=" + Measurements.ArmLength);

            SleeveMaker calcResultAdjusted = new SleeveMaker(start, Measurements);

            calcResultAdjusted.BuildSleeve(calcResult.ScyeHeightCalculated, calcResult.SleeveHeightCalculated - Measurements.ArmLength);
            Entities.AddRange(calcResultAdjusted.Entities);
            FrontArmBezierLength = calcResultAdjusted.FrontBezierLengthCalculated;
            BackArmBezierLength  = calcResultAdjusted.BackBezierLengthCalculated;

            System.Diagnostics.Debug.WriteLine("SleeveMaker [After Adjustment] Sleeve Length=" + calcResultAdjusted.SleeveHeightCalculated + " Arm Length=" + Measurements.ArmLength);

            Vector2 textPos = start + Utils.Right(15) + Utils.Up(100);

            AddTextEntity(textPos, "Sleeve");
            AddPartEntityGrainLine(
                textPos + Utils.Up(50) + Utils.Right(0),
                textPos + Utils.Up(200) + Utils.Right(0),
                "Grain", false);

            //add seam and hem allowance entities
            float sa = Measurements.GarmentSeamAllowance;
            float ha = Measurements.GarmentHemAllowance;

            List <PartEntityOffset> offsetLines = new List <PartEntityOffset>
            {
                calcResultAdjusted.SleeveLengthFrontBezier.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                calcResultAdjusted.FrontBezier1.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                calcResultAdjusted.FrontBezier2.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                calcResultAdjusted.BackBezier1.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                calcResultAdjusted.BackBezier2.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                calcResultAdjusted.SleeveLengthBackBezier.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                calcResultAdjusted.WristLine.CalcOffset(ha, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.HA),
            };

            PartEntityOffset.Intersect(offsetLines, EntityType.PerpConstruction);
            offsetLines.ForEach(x => AddLineEntities(x));
        }
コード例 #2
0
        public override void BuildPart(Vector2 start)
        {
            base.BuildPart(start);

            PartEntityLine firstLine =
                AddLineEntity(LineDirection.Right, start, Measurements.GarmentHoodInsertWidth);
            PartEntityLine secondLine =
                AddLineEntity(LineDirection.Up, hoodLengthForCutout);
            PartEntityLine thirdLine =
                AddLineEntity(LineDirection.Left, Measurements.GarmentHoodInsertWidth);
            PartEntityLine fourthLine =
                AddLineEntity(LineDirection.Down, hoodLengthForCutout);

            Vector2 textPos = start + Utils.Right(50) + Utils.Up(50);

            AddTextEntity(textPos, "Hood Insert", true);
            AddPartEntityGrainLine(
                textPos + Utils.Up(200),
                textPos + Utils.Up(350),
                "Grain", true);

            //add seam and hem allowance entities
            float sa = Measurements.GarmentSeamAllowance;
            float ha = Measurements.GarmentHemAllowance;

            List <PartEntityOffset> offsetLines = new List <PartEntityOffset>
            {
                firstLine.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                secondLine.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                thirdLine.CalcOffset(ha, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.HA),
                fourthLine.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA)
            };

            PartEntityOffset.Intersect(offsetLines, EntityType.PerpConstruction);
            offsetLines.ForEach(x => AddLineEntities(x));
        }
コード例 #3
0
ファイル: BodicePart.cs プロジェクト: vicente-da-silva/YCYR
        public override void BuildPart(Vector2 start)
        {
            base.BuildPart(start);

            BodiceMaker maker = new BodiceMaker(Start, Measurements, neckBezierLength, bodiceType);

            maker.CalcNeckDepth(curvinessFactor);
            Entities.AddRange(maker.Entities);

            PartEntityLine shoulderLine =
                AddLineEntity(Measurements.ShoulderLength, 270 + Measurements.ShoulderAngle);

            float bodiceSleeveCutoutHeightFromShoulderCircumference = Measurements.ShoulderCirc * 0.44f;

            PartEntityLine endScyeDepthCons1 =
                AddLineEntity(LineDirection.Down, bodiceSleeveCutoutHeightFromShoulderCircumference, EntityType.Construction);
            //1/4 of chest circ - measurement from start (CF) to shoulder end (start of scy depth line)
            float          chest             = (Measurements.ChestCirc * Utils.quarter) - (endScyeDepthCons1.End.X - start.X);
            PartEntityLine endScyeDepthCons2 =
                AddLineEntity(LineDirection.Right, chest, EntityType.Construction);

            BezierCalculator.CalcResult adjustmentsSleeve = BezierCalculator.Calc(
                sleeveBezierLength,
                shoulderLine.End,
                endScyeDepthCons2.End,
                BezierCalculator.BezierCalculatorControlPointDirection.Down,
                BezierCalculator.BezierCalculatorControlPointDirection.Left);

            if (!adjustmentsSleeve.SolutionFound)
            {
                throw new SolutionFailureException("Bodice " + bodiceType.ToString() + " solution failure, could not calculate sleeve line length to match sleeve");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Bodice " + bodiceType.ToString() + " Shoulder solution found, required length " + sleeveBezierLength + " foundLength =" + adjustmentsSleeve.FoundLength);
            }

            //arm
            PartEntityBezier armBezier =
                AddBezierEntity(shoulderLine.End, endScyeDepthCons2.End, adjustmentsSleeve.Firstpoint, adjustmentsSleeve.SecondPoint);

            PartEntityLine remainingLengthLine =
                AddLineEntity(endScyeDepthCons2.End, new Vector2(endScyeDepthCons2.End.X, start.Y));
            PartEntityLine lastLine =
                AddLineEntity(remainingLengthLine.End, start);

            Vector2 textPos = start + Utils.Right(25) + Utils.Up(100);

            AddTextEntity(textPos, bodiceType.ToString());
            AddPartEntityGrainLine(
                textPos + Utils.Up(50),
                textPos + Utils.Up(200),
                "Grain", false);

            //add seam and hem allowance entities
            float sa = Measurements.GarmentSeamAllowance;
            float ha = Measurements.GarmentHemAllowance;

            List <PartEntityOffset> offsetLines = new List <PartEntityOffset>
            {
                maker.GarmentLengthLine.CalcOffset(sa, PerpendicularRotation.Clockwise, EntityType.PerpConstruction, EntityType.SA),
                maker.NeckBezier.CalcOffset(sa, PerpendicularRotation.Clockwise, EntityType.PerpConstruction, EntityType.SA),
                shoulderLine.CalcOffset(sa, PerpendicularRotation.Clockwise, EntityType.PerpConstruction, EntityType.SA),
                armBezier.CalcOffset(sa, PerpendicularRotation.Clockwise, EntityType.PerpConstruction, EntityType.SA),
                remainingLengthLine.CalcOffset(sa, PerpendicularRotation.Clockwise, EntityType.PerpConstruction, EntityType.SA),
                lastLine.CalcOffset(ha, PerpendicularRotation.Clockwise, EntityType.PerpConstruction, EntityType.HA),
            };

            PartEntityOffset.Intersect(offsetLines, EntityType.PerpConstruction);
            offsetLines.ForEach(x => AddLineEntities(x));

            //List<PerpConstructionLines> consLines = AddDefaultSAConstructionLines(sa, PerpendicularRotation.Clockwise, EntityType.ConstructionSA);
            //consLines.ForEach(x => x.AddLinesToPattern(this));
            //AddSALines(consLines);
        }
コード例 #4
0
ファイル: HoodPart.cs プロジェクト: vicente-da-silva/YCYR
        public override void BuildPart(Vector2 start)
        {
            base.BuildPart(start);

            float garmentHoodBaseStep   = 50f;// (Measurements.GarmentBodiceFrontNeckDepth - Measurements.GarmentBodiceBackNeckDepth) * Utils.half;
            float hoodHeight            = (Utils.half * Measurements.ShoulderToShoulderOverHead) + (Utils.twoThirds * (garmentHoodBaseStep));
            float hoodHeightLessZipEdge = hoodHeight - Measurements.GarmentHoodZipEdge;
            float hoodInsertWidth       = Measurements.GarmentHoodInsertWidth * Utils.half;
            float hoodWidth             = Measurements.GarmentHoodLenghtFromTemple + (Utils.half * Measurements.CircTempleToTemple) - hoodInsertWidth;
            float hoodHeadCurveRadius   = Measurements.HeadBackCurveRadius;

            float fullHoodWidth           = hoodWidth + Measurements.GarmentHoodSetBackFromZip;
            float frontBaseLength         = (fullHoodWidth + hoodInsertWidth) * Utils.threeFifths;
            float backBaseLength          = fullHoodWidth - frontBaseLength;
            float backBezierVerticalPoint = Utils.twoThirds * garmentHoodBaseStep;

            PartEntityLine hoodZipEdge =
                AddLineEntity(LineDirection.Up, start, Measurements.GarmentHoodZipEdge);
            PartEntityLine hoodSetBackUp1 =
                AddLineEntity(LineDirection.Left, Measurements.GarmentHoodSetBackFromZip, EntityType.Construction);
            PartEntityLine hoodSetBackUp2 =
                AddLineEntity(LineDirection.Up, hoodHeightLessZipEdge * Utils.third, EntityType.Construction);

            //PartEntity zipBezier;
            //if (Measurements.GarmentHoodSetBackFromZip == 0)
            //{
            //    zipBezier =
            //        AddLineEntity(hoodZipEdge.End, hoodSetBackUp2.End);
            //}
            //else
            //{
            //    zipBezier =
            //        AddBezierEntity(hoodZipEdge.End, hoodSetBackUp2.End,
            //        Measurements.GarmentHoodSetBackFromZip > 0 ? Utils.Left(40) : Utils.Left(0),
            //        Measurements.GarmentHoodSetBackFromZip > 0 ? Utils.Down(80) : Utils.Left(0));
            //}

            PartEntityBezier zipBezier =
                AddBezierEntity(hoodZipEdge.End, hoodSetBackUp2.End,
                                Measurements.GarmentHoodSetBackFromZip > 0 ? Utils.Left(40) : Utils.Left(0),
                                Measurements.GarmentHoodSetBackFromZip > 0 ? Utils.Down(80) : Utils.Left(0));

            PartEntityLine hoodHeightLessZipEdgeLine =
                AddLineEntity(LineDirection.Up, zipBezier.End, hoodHeightLessZipEdge * Utils.twoThirds);
            PartEntityLine hoodTopToHeadCurveStart =
                AddLineEntity(LineDirection.Left, hoodWidth - hoodHeadCurveRadius);

            AddLineEntity(LineDirection.Left, hoodHeadCurveRadius, EntityType.Construction);
            PartEntityLine hoodTopToHeadCurveEnd =
                AddLineEntity(LineDirection.Down, hoodHeadCurveRadius, EntityType.Construction);
            PartEntityBezier headBezier =
                AddBezierEntity(hoodTopToHeadCurveStart.End, hoodTopToHeadCurveEnd.End, Utils.Left(100), Utils.Up(100));
            PartEntityLine hoodToEndWidth =
                AddLineEntity(LineDirection.Down, hoodTopToHeadCurveEnd.End, (start.Y - hoodTopToHeadCurveEnd.End.Y) - garmentHoodBaseStep);

            AddLineEntity(LineDirection.Right, backBaseLength, EntityType.Construction);
            PartEntityLine baseNeckLineDown =
                AddLineEntity(LineDirection.Down, garmentHoodBaseStep, EntityType.Construction);

            AddLineEntity(LineDirection.Right, frontBaseLength, EntityType.Construction);
            PartEntityBezier neckBezierBack =
                AddBezierEntity(hoodToEndWidth.End, baseNeckLineDown.End + Utils.Up(backBezierVerticalPoint), Utils.Right(20), Utils.Left(20) + Utils.Up(20));
            PartEntityBezier neckBezierFront =
                AddBezierEntity(neckBezierBack.End, start, Utils.Right(40) + Utils.Down(40), Utils.Left(50));

            Vector2 textPos = start + Utils.Left(fullHoodWidth) + Utils.Right(25) + Utils.Up(75);

            AddTextEntity(textPos, "Hood");
            AddPartEntityGrainLine(
                textPos + Utils.Up(0) + Utils.Right(75),
                textPos + Utils.Up(150) + Utils.Right(75),
                "Grain", false);

            HoodPathLengthForCutout += hoodTopToHeadCurveStart.Length();
            HoodPathLengthForCutout += headBezier.Length;;
            HoodPathLengthForCutout += hoodToEndWidth.Length();
            HoodNeckFrontLength      = neckBezierFront.Length;
            HoodNeckBackLength       = neckBezierBack.Length + hoodInsertWidth;

            //add seam and hem allowance entities
            float sa = Measurements.GarmentSeamAllowance;
            float ha = Measurements.GarmentHemAllowance;

            List <PartEntityOffset> offsetLines = new List <PartEntityOffset>
            {
                hoodZipEdge.CalcOffset(ha, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.HA),
                zipBezier.CalcOffset(ha, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.HA),
                hoodHeightLessZipEdgeLine.CalcOffset(ha, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.HA),
                hoodTopToHeadCurveStart.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                headBezier.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                hoodToEndWidth.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                neckBezierBack.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
                neckBezierFront.CalcOffset(sa, PerpendicularRotation.AntiClockwise, EntityType.PerpConstruction, EntityType.SA),
            };

            PartEntityOffset.Intersect(offsetLines, EntityType.PerpConstruction);
            offsetLines.ForEach(x => AddLineEntities(x));
        }