tmilos/cgi-calc
Composer 安装命令:
composer require tmilos/cgi-calc
包简介
README 文档
README
Casual Gaming Infrastructure - Calc PHP library.
Point
$point = new Point(10, 10); print $point->getX(); print $point->getY(); $leftPoint = $point->left(); $otherPoint = $point->move(new Point(2, 3));
PointSet
$set = new PointSet([new Point(10, 10), new Point(20, 20)]); $set[new Point(10, 10)] = 'something'; $set->contains(new Point(10, 10)); // true print $set[new Point(10, 10)]; // something $other = new PointSet([new Point(10, 10), new Point(0, 0)]); $unionSet = $set->union($other); $intersectionSet = $set->intersect($other); $differenceSet = $set->diff($other);
Field Producers
$rectangularProducer = new RectangularFromTwoPoints(new Point(0,0), new Point(3, 2), function (Point $point) { // value provider for the points of the generated rectangular return sprintf("%d : %d", $point->getX(), $point->getY()); }); $rect = $rectangularProducer->produce();
$rectangularProducer = new RectangularFromTwoPoints(new Point(2,3), 10, 8); $rect = $rectangularProducer->produce();
$circleProducer = new CircularCenterRadius(new Point(10,10), 8); $circle = $circleProducer->produce();
License
Copyright Milos Tomic. This package is licensed under MIT, for details check the LICENSE file.
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-05