本文整理汇总了PHP中Point::from_xy方法的典型用法代码示例。如果您正苦于以下问题:PHP Point::from_xy方法的具体用法?PHP Point::from_xy怎么用?PHP Point::from_xy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point::from_xy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bounding_box
public function bounding_box()
{
$max_x = -INF;
$max_y = -INF;
$min_x = INF;
$min_y = INF;
if (!$this->with_z) {
foreach ($this->geometries as $geom) {
$bbox = $geom->bounding_box();
$ll = $bbox[0];
$ur = $bbox[1];
if ($ll->x < $min_x) {
$min_x = $ll->x;
}
if ($ll->y < $min_y) {
$min_y = $ll->y;
}
if ($ur->x > $max_x) {
$max_x = $ur->x;
}
if ($ur->y > $max_y) {
$max_y = $ur->y;
}
}
return array(Point::from_xy($min_x, $min_y), Point::from_xy($max_x, $max_y));
} else {
$max_z = INF;
$min_z = -INF;
foreach ($this->geometries as $geom) {
$bbox = $geom->bounding_box();
$ll = $bbox[0];
$ur = $bbox[1];
if ($ll->x < $min_x) {
$min_x = $ll->x;
}
if ($ll->y < $min_y) {
$min_y = $ll->y;
}
if ($ll->z < $min_z) {
$min_z = $ll->z;
}
if ($ur->x > $max_x) {
$max_x = $ur->x;
}
if ($ur->y > $max_y) {
$max_y = $ur->y;
}
if ($ur->z > $max_z) {
$max_y = $ur->z;
}
}
return array(Point::from_xy($min_x, $min_y), Point::from_xy($max_x, $max_y));
}
}
示例2: bounding_box
public function bounding_box()
{
$max_x = -INF;
$max_y = -INF;
$min_x = INF;
$min_y = INF;
if (!$this->with_z) {
foreach ($this->points as $p) {
if ($p->x < $min_x) {
$min_x = $p->x;
}
if ($p->y < $min_y) {
$min_y = $p->y;
}
if ($p->x > $max_x) {
$max_x = $p->x;
}
if ($p->y > $max_y) {
$max_y = $p->y;
}
}
return array(Point::from_xy($min_x, $min_y), Point::from_xy($max_x, $max_y));
} else {
$max_z = -INF;
$min_z = INF;
foreach ($this->points as $p) {
if ($p->x < $min_x) {
$min_x = $p->x;
}
if ($p->y < $min_y) {
$min_y = $p->y;
}
if ($p->z < $min_z) {
$min_z = $p->z;
}
if ($p->x > $max_x) {
$max_x = $p->x;
}
if ($p->y > $max_y) {
$max_y = $p->y;
}
if ($p->z > $max_z) {
$max_z = $p->z;
}
}
return array(Point::from_xyz($min_x, $min_y, $min_z), Point::from_xyz($max_x, $max_y, $max_z));
}
}