private static function addMemberDistributedLoadByMembers($members, $object) { $x1 = $object->getProperty('x1')->get(); $y1 = $object->getProperty('y1')->get(); $z1 = $object->getProperty('z1')->get(); $value1 = $object->getProperty('value1')->get(); $x2 = $object->getProperty('x2')->get(); $y2 = $object->getProperty('y2')->get(); $z2 = $object->getProperty('z2')->get(); $value2 = $object->getProperty('value2')->get(); // Prepare Load Point $loadPoint1 = new \Classes\Utils\AbstractInstance\Point($x1, $y1, $z1); $loadPoint2 = new \Classes\Utils\AbstractInstance\Point($x2, $y2, $z2); // Prepare Load Line $loadLine = new \Classes\Utils\AbstractInstance\Line($loadPoint1, $loadPoint2); $loadLineLength = $loadLine->length(); // Try to find member with necessary coordinates $i = 0; $isFound = FALSE; while ($i < count($members) && $isFound === FALSE) { $member = $members[$i]; $connections = array_keys(self::$hashTable->getConnection($member->getUin())); $node1 = self::$nodes[$connections[0]]; $node2 = self::$nodes[$connections[1]]; // Prepare Node Point $node1Point = new \Classes\Utils\AbstractInstance\Point($node1->getProperty('x')->get(), $node1->getProperty('y')->get(), $node1->getProperty('z')->get()); $node2Point = new \Classes\Utils\AbstractInstance\Point($node2->getProperty('x')->get(), $node2->getProperty('y')->get(), $node2->getProperty('z')->get()); // Prepare Line $memberLine = new \Classes\Utils\AbstractInstance\Line($node1Point, $node2Point); // Array for arrays with overlapping coordinates $loadOverlap = array(); $memberOverlap = array(); // Find overlapping of lines if (\Classes\Utils\Math\Lines::findOverlappingOfTwoLines($loadLine, $memberLine, $loadOverlap, $memberOverlap)) { $isFound = TRUE; // Make new node load $load = new \Classes\Instance\Load\Member\DistributedMemberLoad(); // Get LOAD Positions $loadPos1 = new \Classes\Value\FloatValue($memberOverlap[0]); $loadPos2 = new \Classes\Value\FloatValue($memberOverlap[1]); $load->setProperty('position1', $loadPos1); $load->setProperty('position2', $loadPos2); // Get LOAD Values $loadValue1 = new \Classes\Value\FloatValue($value1 + ($value2 - $value1) * $loadOverlap[0] / $loadLineLength); $loadValue2 = new \Classes\Value\FloatValue($value1 + ($value2 - $value1) * $loadOverlap[1] / $loadLineLength); if (\Classes\Utils\Math\Lines::areTwoVectorHaveSameDirection($loadLine, $memberLine)) { $load->setProperty('value1', $loadValue1); $load->setProperty('value2', $loadValue2); } else { $load->setProperty('value1', $loadValue2); $load->setProperty('value2', $loadValue1); } // Add connection self::$loadTable->setConnection($load->getUin(), $member->getUin(), new \Classes\Factory\Connection\LoadConnection\GlobalCoordinateSystem()); // Add new load to array self::$loads[] = $load; // Check rmainig parts of $loadLine // Begin part if (!\Classes\Utils\Math\Constant::isNumbersEqual($loadOverlap[0], 0)) { // Find end point of begin part $endPoint = \Classes\Utils\Math\Lines::getPointOnLineWithOffset($loadLine, $loadOverlap[0]); // Make new object $beginObject = clone $object; //Set Properties $beginObject->setProperty('x2', new \Classes\Value\FloatValue($endPoint->x)); $beginObject->setProperty('y2', new \Classes\Value\FloatValue($endPoint->y)); $beginObject->setProperty('z2', new \Classes\Value\FloatValue($endPoint->z)); $beginObject->setProperty('value2', $loadValue1); self::addMemberDistributedLoadByMembers(array_slice($members, $i + 1), $beginObject); } // End part if (!\Classes\Utils\Math\Constant::isNumbersEqual($loadOverlap[1], $loadLineLength)) { // Find begin point of end part $beginPoint = \Classes\Utils\Math\Lines::getPointOnLineWithOffset($loadLine, $loadOverlap[1]); // Make new object $endObject = clone $object; //Set Properties $endObject->setProperty('x1', new \Classes\Value\FloatValue($beginPoint->x)); $endObject->setProperty('y1', new \Classes\Value\FloatValue($beginPoint->y)); $endObject->setProperty('z1', new \Classes\Value\FloatValue($beginPoint->z)); $endObject->setProperty('value1', $loadValue2); self::addMemberDistributedLoadByMembers(array_slice($members, $i + 1), $endObject); } } $i++; } // If $object has NOT been found if (!$isFound) { self::$notFoundObject[] = $object; } }
private static function addDistributedCommonMemberLoad($node, $commonMemberLoad, $commonMemberLoadEndNumber, $actualMemberUins) { $isFound = FALSE; // Get Nodes of Common Member Load $loadConnections = array_keys(self::$commonMemberLoadTable->getConnection($commonMemberLoad->getUin())); $loadNode1 = self::$nodes[$loadConnections[0]]; $loadNode2 = self::$nodes[$loadConnections[1]]; // Prepare Load Point $loadPoint1 = \Classes\Utils\AbstractInstance\Point::createFromNode($loadNode1); $loadPoint2 = \Classes\Utils\AbstractInstance\Point::createFromNode($loadNode2); // Prepare Load Line $loadLine = new \Classes\Utils\AbstractInstance\Line($loadPoint1, $loadPoint2); $loadLineLength = $loadLine->length(); // Try to find member with necessary coordinates while ((list($memberUin, $memberEndNumber) = each($actualMemberUins)) && $isFound === FALSE) { $memberConnections = array_keys(self::$hashTable->getConnection($memberUin)); $memberNode1 = self::$nodes[$memberConnections[0]]; $memberNode2 = self::$nodes[$memberConnections[1]]; // Prepare Node Point $memberPoint1 = \Classes\Utils\AbstractInstance\Point::createFromNode($memberNode1); $memberPoint2 = \Classes\Utils\AbstractInstance\Point::createFromNode($memberNode2); // Prepare Line $memberLine = new \Classes\Utils\AbstractInstance\Line($memberPoint1, $memberPoint2); // Array for arrays with overlapping coordinates $loadOverlap = array(); $memberOverlap = array(); // Find overlapping of lines if (\Classes\Utils\Math\Lines::findOverlappingOfTwoLines($loadLine, $memberLine, $loadOverlap, $memberOverlap)) { $isFound = TRUE; // Make new node load $load = new \Classes\Instance\Load\Member\DistributedMemberLoad(); // Get LOAD Positions $loadPos1 = new \Classes\Value\FloatValue($memberOverlap[0]); $loadPos2 = new \Classes\Value\FloatValue($memberOverlap[1]); $load->setProperty('position1', $loadPos1); $load->setProperty('position2', $loadPos2); // Get LOAD Values $value1 = self::$value1->get(); $value2 = self::$value2->get(); $loadValue1 = new \Classes\Value\FloatValue($value1 + ($value2 - $value1) * $loadOverlap[0] / $loadLineLength); $loadValue2 = new \Classes\Value\FloatValue($value1 + ($value2 - $value1) * $loadOverlap[1] / $loadLineLength); $isLoadAndMemberSameDirection = \Classes\Utils\Math\Lines::areTwoVectorHaveSameDirection($loadLine, $memberLine); if ($isLoadAndMemberSameDirection) { $load->setProperty('value1', $loadValue1); $load->setProperty('value2', $loadValue2); } else { $load->setProperty('value1', $loadValue2); $load->setProperty('value2', $loadValue1); } // Add connection self::$loadTable->setConnection($load->getUin(), $memberUin, new \Classes\Factory\Connection\LoadConnection\GlobalCoordinateSystem()); // Add new load self::setLoadProperties($load); $isBeginPartExist = !\Classes\Utils\Math\Constant::isNumbersEqual($loadOverlap[0], 0); $isEndPartExist = !\Classes\Utils\Math\Constant::isNumbersEqual($loadOverlap[1], $loadLineLength); // Get Uin of member's node, which is more far from sweep line switch ($memberEndNumber) { case 0: $memberEdgeUin = $memberNode2->getUin(); break; case 1: $memberEdgeUin = $memberNode1->getUin(); break; } // Check remainig parts of $loadLine // Begin part if ($isBeginPartExist) { // Find end point of begin part $endPoint = \Classes\Utils\Math\Lines::getPointOnLineWithOffset($loadLine, $loadOverlap[0]); // Make new object $beginObject = clone $commonMemberLoad; //Set Properties $beginObject->setProperty('x2', new \Classes\Value\FloatValue($endPoint->x)); $beginObject->setProperty('y2', new \Classes\Value\FloatValue($endPoint->y)); $beginObject->setProperty('z2', new \Classes\Value\FloatValue($endPoint->z)); $beginObject->setProperty('value2', $loadValue1); self::$commonMemberLoadArray[$beginObject->getUin()] = $beginObject; //If begin part is near sweep line if ($commonMemberLoadEndNumber == 0) { self::$notFoundObjects[] = $beginObject->getUin(); } //If begin part is far from sweep line if ($commonMemberLoadEndNumber == 1) { // Set connection btw 1st node of CommonMemberLoad and beginObject self::$commonMemberLoadTable->setConnection($beginObject->getUin(), $loadNode1->getUin(), self::$emptyConnection); // Set connection between end of member anв beginObject self::$commonMemberLoadTable->setConnection($beginObject->getUin(), $memberEdgeUin, self::$emptyConnection); } } // End part if ($isEndPartExist) { // Find begin point of end part $beginPoint = \Classes\Utils\Math\Lines::getPointOnLineWithOffset($loadLine, $loadOverlap[1]); // Make new object $endObject = clone $commonMemberLoad; //Set Properties $endObject->setProperty('x1', new \Classes\Value\FloatValue($beginPoint->x)); $endObject->setProperty('y1', new \Classes\Value\FloatValue($beginPoint->y)); $endObject->setProperty('z1', new \Classes\Value\FloatValue($beginPoint->z)); $endObject->setProperty('value1', $loadValue2); self::$commonMemberLoadArray[$endObject->getUin()] = $endObject; //If begin part is near sweep line if ($commonMemberLoadEndNumber == 0) { // Set connection between end of member anв beginObject self::$commonMemberLoadTable->setConnection($endObject->getUin(), $memberEdgeUin, self::$emptyConnection); // Set connection btw 2nd node of CommonMemberLoad and beginObject self::$commonMemberLoadTable->setConnection($endObject->getUin(), $loadNode2->getUin(), self::$emptyConnection); } //If begin part is far from sweep line if ($commonMemberLoadEndNumber == 1) { self::$notFoundObjects[] = $endObject->getUin(); } } // Delete Common Member Load self::$commonMemberLoadTable->removeConnection($commonMemberLoad->getUin(), $loadNode1->getUin()); self::$commonMemberLoadTable->removeConnection($commonMemberLoad->getUin(), $loadNode2->getUin()); unset(self::$commonMemberLoadArray[$commonMemberLoad->getUin()]); } } return $isFound; }