本文整理匯總了PHP中Connect::increaseLength方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connect::increaseLength方法的具體用法?PHP Connect::increaseLength怎麽用?PHP Connect::increaseLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Connect
的用法示例。
在下文中一共展示了Connect::increaseLength方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: generateNodes
private function generateNodes()
{
$newNodeList = array();
for ($i = 0; $i < count($this->nodes) - 1; $i++) {
$length = $this->nodes[$i]->distance($this->nodes[$i + 1]);
if ($length > $this->el_max) {
// generate new nodes
$distance = $length / ceil($length / $this->el_max);
// new distance between nodes
$element = new Connect(clone $this->nodes[$i], clone $this->nodes[$i], 0, 0);
do {
$element->increaseLength($distance);
array_push($newNodeList, clone $element->endNode);
} while ($element->endNode->compare($this->nodes[$i + 1]) == -1);
}
}
foreach ($newNodeList as $n) {
$this->addNode($n);
}
$this->nodes = Node::quickSort($this->nodes);
}