Last active
December 25, 2015 01:19
-
-
Save kylenoland/6893878 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
private function getDrapeWidths(DrapeItem $drapeItem, DrapeUnit $drapeUnit, DrapeCutDefault $drapeCutDefault) | |
{ | |
// Pinch Pleat DrapeItem | |
if($drapeItem->isPinchPleat()) | |
{ | |
// Pinch Pleat Pair DrapeItem | |
if($drapeItem->isPairStack()) | |
{ | |
// Pinch Pleat Pair DrapeItem with a Non-Railroaded DrapeCutDefault | |
if( ! $drapeCutDefault->isRailroaded()) | |
{ | |
$drapeWidths = (($drapeUnit->rod_size * $drapeItem->Fullness->amount) + (2 * $drapeItem->Overlap->amount) + (2 * $drapeItem->Return->amount) ) / $drapeCutDefault->fabric_width; | |
// Rounding rules per the previous docs for Pinch Pleat Non-RR Pair Widths Face | |
// Divide the final rounded value by 2 | |
$fraction = getFraction($drapeWidths); | |
// Round up or down to get a whole number | |
$drapeWidths = ($fraction < 0.10) ? floor($drapeWidths) : ceil($drapeWidths); | |
// Divide by 2 since this is a Pair Drape Item | |
return $drapeWidths / 2; | |
} | |
// Pinch Pleat Pair DrapeItem with a Railroaded DrapeCutDefault | |
else | |
{ | |
} | |
} | |
// Pinch Pleat Panel DrapeItem | |
else | |
{ | |
// Pinch Pleat Panel DrapeItem with a Railroaded DrapeCutDefault | |
if($drapeCutDefault->isRailroaded()) | |
{ | |
$drapeWidths = (($drapeUnit->rod_size * $drapeItem->Fullness->amount) + $drapeItem->Overlap->amount + $drapeItem->Return->amount) / $drapeCutDefault->fabric_width; | |
$fraction = getFraction($drapeWidths); | |
// Rounding per the previous docs for Pinch Pleat RR Panel Cut At | |
if($fraction < 0.10) return floor($drapeWidths); | |
if($fraction >= 0.10 and $fraction <= 0.25) return floor($drapeWidths) + 0.25; | |
if($fraction > 0.25 and $fraction <= 0.50) return floor($drapeWidths) + 0.50; | |
if($fraction > 0.50 and $fraction <= 0.75) return floor($drapeWidths) + 0.75; | |
return ceil($drapeWidths); | |
} | |
// Pinch Pleat Panel DrapeItem with a Non-Railroaded DrapeCutDefault | |
else | |
{ | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment