PHPackages                             anton-panfilov/geo1d - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. anton-panfilov/geo1d

ActiveLibrary

anton-panfilov/geo1d
====================

1D geometry

1.0.0(2y ago)04MITPHPPHP &gt;=8.1

Since Mar 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/anton-panfilov/geo1d)[ Packagist](https://packagist.org/packages/anton-panfilov/geo1d)[ RSS](/packages/anton-panfilov-geo1d/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

1D Geometry
===========

[](#1d-geometry)

1D geometry for PHP 8.1+

Geometry Intersections Documentation
------------------------------------

[](#geometry-intersections-documentation)

The `Geometry\Intersects` provides functionalities to determine the intersections between various 1D geometric entities such as points, segments, and vectors.

Shapes
------

[](#shapes)

- **Point**: Represents a point in a 1D space.
- **Segment**: Represents a line segment defined by two endpoints.
- **Vector**: Represents an infinite line starting from a point and extending in a specified direction.

Example Usages
--------------

[](#example-usages)

Below are examples demonstrating how to use each method in the `Geometry` class.

### intersectsPoints Example

[](#intersectspoints-example)

```
// Create two points
$point1 = new Point(1, true);
$point2 = new Point(1, true);

// Check if the points intersect
$result = Intersects::intersectsPoints($point1, $point2);

// Output: true
echo $result ? 'true' : 'false';
```

### intersectsPointAndSegment Example

[](#intersectspointandsegment-example)

```
// Create a point and a segment
$point = new Point(2, true);
$segment = new Segment(new Point(1, true), new Point(3, true));

// Check if the point intersects with the segment
$result = Intersects::intersectsPointAndSegment($point, $segment);

// Output: true
echo $result ? 'true' : 'false';
```

### intersectsPointAndVector Example

[](#intersectspointandvector-example)

```
// Create a point and a vector
$point = new Point(5, true);
$vector = new Vector(new Point(2, true), true);

// Check if the point intersects with the vector
$result = Intersects::intersectsPointAndVector($point, $vector);

// Output: true
echo $result ? 'true' : 'false';
```

### intersectsSegments Example

[](#intersectssegments-example)

```
// Create two segments
$segment1 = new Segment(new Point(1, true), new Point(4, true));
$segment2 = new Segment(new Point(3, true), new Point(5, true));

// Check if the segments intersect
$result = Intersects::intersectsSegments($segment1, $segment2);

// Output: true
echo $result ? 'true' : 'false';
```

### intersectsSegmentAndVector Example

[](#intersectssegmentandvector-example)

```
// Create a segment and a vector
$segment = new Segment(new Point(1, true), new Point(3, true));
$vector = new Vector(new Point(2, true), true);

// Check if the segment intersects with the vector
$result = Intersects::intersectsSegmentAndVector($segment, $vector);

// Output: true
echo $result ? 'true' : 'false';
```

### intersectsVectors Example

[](#intersectsvectors-example)

```
// Create two vectors
$vector1 = new Vector(new Point(0, true), true);
$vector2 = new Vector(new Point(2, true), false);

// Check if the vectors intersect
$result = Intersects::intersectsVectors($vector1, $vector2);

// Output: true (since both vectors are infinite in one direction, they intersect)
echo $result ? 'true' : 'false';
```

These examples provide a practical guide on how to use each method in your `Intersects` class, showcasing the creation of `Point`, `Segment`, and `Vector` objects and how they can be used to check for intersections.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

2

Last Release

788d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.1

0.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/1215fe5ecc9ba0ab1c730d3c992125cf6ebf460562e66be71ebae127789d465a?d=identicon)[AntonPanfilov](/maintainers/AntonPanfilov)

---

Top Contributors

[![anton-panfilov](https://avatars.githubusercontent.com/u/1083546?v=4)](https://github.com/anton-panfilov "anton-panfilov (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anton-panfilov-geo1d/health.svg)

```
[![Health](https://phpackages.com/badges/anton-panfilov-geo1d/health.svg)](https://phpackages.com/packages/anton-panfilov-geo1d)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
