public static function add($object) { // GET NODES $nodes = array_values(\Classes\Factory\Model\Model::getNodes()); //GET RESTRAINT TABLE $resTable = \Classes\Factory\Model\Model::getRestraintTable(); // RESTRAINT $restraint = new \Classes\Factory\Connection\SixFreedomConnection\RestraintConnection($object->getProperty('fix')->get()); // RESTRAINT POINT $resPoint = new \Classes\Utils\AbstractInstance\Point($object->getProperty('x')->get(), $object->getProperty('y')->get(), $object->getProperty('z')->get()); // TRY TO FIND NODE FOR RESTRAINT'S APPLICATION $isFound = FALSE; $i = 0; while ($isFound === FALSE && $i < count($nodes)) { $node = $nodes[$i]; // NODE POINT $nodePoint = new \Classes\Utils\AbstractInstance\Point($node->getProperty('x')->get(), $node->getProperty('y')->get(), $node->getProperty('z')->get()); if (\Classes\Utils\Math\Points::isPointSame($nodePoint, $resPoint)) { // ADD CONNECTION $resTable->setConnection($node->getUin(), $restraint); $isFound = TRUE; } $i++; } }
public function length() { return \Classes\Utils\Math\Points::twoPointsDistance($this->point1, $this->point2); }
private static function addMemberConcentratedLoad() { // Prepare Load Point $loadPoint = new \Classes\Utils\AbstractInstance\Point(self::$x1->get(), self::$y1->get(), self::$z1->get()); // Try to find member with necessary coordinates $i = 0; $members = array_values(self::$members); while ($i < count($members) && self::$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 $line = new \Classes\Utils\AbstractInstance\Line($node1Point, $node2Point); // if ($node1Point->x == 2.0 && $node1Point->y == 2.6 && $node1Point->z == 15.0 && // $node2Point->x == 2.6 && $node2Point->y == 2.0 && $node2Point->z == 15.0) { // echo "HERE<br/>"; // } // Compare coordinates if (\Classes\Utils\Math\Points::isPointOnLine($loadPoint, $line) == 3) { self::$isFound = TRUE; // Make new node load $load = new \Classes\Instance\Load\Member\ConcenratedMemberLoad(); $position = new \Classes\Value\FloatValue(\Classes\Utils\Math\Points::twoPointsDistance($node1Point, $loadPoint)); // Set Properties $load->setProperty('value', self::$value1); $load->setProperty('position', $position); // Add connection self::$loadTable->setConnection($load->getUin(), $member->getUin(), new \Classes\Factory\Connection\LoadConnection\GlobalCoordinateSystem()); // Add new load to array self::$loads[] = $load; } else { // If $object is NOT found, $object itself must be returned self::$notFoundObject = array(self::$object); } $i++; } }
public static function divideAllMembersByExistingNodes() { // SORT NODES \Classes\Utils\Timer\Timer::start('SORT_NODES'); \Classes\Factory\Model\Model::sortNodes(); \Classes\Utils\Timer\Timer::start('SORT_NODES'); // Get nodes and members $nodes = \Classes\Factory\Model\Model::getNodes(); $hashTable = \Classes\Factory\Model\Model::getHashTable(); // Array [uin] => [0 - 1st point, 1 - 2nd point] $actualMemberUins = array(); foreach ($nodes as $node) { // Get $node coordinates $point = \Classes\Utils\AbstractInstance\Point::createFromNode($node); $nodeUin = $node->getUin(); $connections = $hashTable->getConnection($nodeUin); // echo "NODE (" . $node->getProperty('x')->get() . ", " . // $node->getProperty('y')->get() . ", " . // $node->getProperty('z')->get() . ") "; // // echo "ACTUAL MEMBERS COUNT = " . count($actualMemberUins) . "<br/>"; // echo "CONNECTIONS: " . implode('; ', array_keys($connections)) . "<br/>"; //Change $actualMemberUins array if (count($connections) > 0) { foreach ($connections as $uin => $c) { // Here $uin is uin of member connected with node if (isset($actualMemberUins[$uin])) { // If member is already included in $actualMemberUins -> delete it unset($actualMemberUins[$uin]); } else { // If member is NOT included in $actualMemberUins -> add it $keys = array_keys($hashTable->getConnection($uin)); $endNumber = array_search($nodeUin, $keys); $actualMemberUins[$uin] = $endNumber; } } } // Divide $actualMemberUins by $node foreach ($actualMemberUins as $memberUin => $endNumber) { // var_dump($actualMemberUins); // Get coordinates of members' ends $memberEndUins = array_keys($hashTable->getConnection($memberUin)); $node1 = $nodes[$memberEndUins[0]]; $node2 = $nodes[$memberEndUins[1]]; $line = \Classes\Utils\AbstractInstance\Line::createFromTwoNodes($node1, $node2); // If point is inside line if (\Classes\Utils\Math\Points::isPointOnLine($point, $line) == 3) { // Divide member by node $newMemberUin = self::divideMemberByNode($memberUin, $nodeUin); // If intersection found AND member's begin before sweep line if ($newMemberUin != FALSE && $endNumber == 0) { // Delete old member from actual array unset($actualMemberUins[$memberUin]); // Add new member to actual array (member's begin also before sweep line) $actualMemberUins[$newMemberUin] = 0; } // If intersection found AND member's begin after sweep line // it's necessary to do nothing, because divided member is // still located after sweep line } } } }
private static function addConcentratedCommonMemberLoad($node, $commonMemberLoad, $actualMemberUins) { $isFound = FALSE; // Check if concentrated load is placed on Node or Member if (!is_null(self::$hashTable->getConnection($node->getUIn()))) { // This is nodal load $isFound = TRUE; // Make new node load $load = new \Classes\Instance\Load\Node\NodeLoad(); // Set Properties $load->setProperty('value', self::$value1); // Add connection self::$loadTable->setConnection($load->getUin(), $node->getUin(), new \Classes\Factory\Connection\LoadConnection\GlobalCoordinateSystem()); } else { // This is load on member // Prepare Load Point $loadPoint = new \Classes\Utils\AbstractInstance\Point(self::$x1->get(), self::$y1->get(), self::$z1->get()); // Try to find member with necessary coordinates while ((list($memberUin, $memberEndNumber) = each($actualMemberUins)) && $isFound === FALSE) { $connections = array_keys(self::$hashTable->getConnection($memberUin)); $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 $line = new \Classes\Utils\AbstractInstance\Line($node1Point, $node2Point); // Compare coordinates if (\Classes\Utils\Math\Points::isPointOnLine($loadPoint, $line) == 3) { $isFound = TRUE; // Make new node load $load = new \Classes\Instance\Load\Member\ConcenratedMemberLoad(); $position = new \Classes\Value\FloatValue(\Classes\Utils\Math\Points::twoPointsDistance($node1Point, $loadPoint)); // Set Properties $load->setProperty('value', self::$value1); $load->setProperty('position', $position); // Add connection self::$loadTable->setConnection($load->getUin(), $memberUin, new \Classes\Factory\Connection\LoadConnection\GlobalCoordinateSystem()); } } } // If Load has been found, add properties and add to Model if ($isFound) { self::setLoadProperties($load); } else { self::$notFoundObjects[] = $commonMemberLoad->getUin(); } return $isFound; }