ForHosting KIT · Math

Circle–line intersection

Find where a straight line crosses a circle: a circle of radius 5 at the origin and the line through (−10, 0) and (10, 0) meet at (−5, 0) and (5, 0). It tells you whether the line cuts, touches or misses. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Cx
0
Cy
0
Resistance (Ω)
5
X1
-10
Y1
0
X2
10
You get
Quantity
2
Discriminant
40,000

A circle and a straight line in the plane can meet at two points (a secant), touch at exactly one point (a tangent), or miss each other entirely. Classical analytic geometry reduces the question to a quadratic equation: parametrize the line through two points, substitute into the circle equation, and read the discriminant. Students checking homework, game developers placing collision contacts, CAD helpers verifying sketch constraints, survey assistants recovering sight-line hits, and contest solvers all need those contact coordinates as stable numbers they can pin in tests—not only a sketch. This capacity accepts seven numbers—cx, cy, r for the circle and x1, y1, x2, y2 for two distinct points on the infinite line—validates that every field is finite and the radius is positive, then solves the quadratic.

What circle–line intersection means and why people search for it

In Euclidean plane geometry, a circle with center C and radius r is the set of points at fixed distance r from C. An infinite line through two distinct points A and B is the set of points A plus a real multiple of the direction vector B minus A. Their intersection is the set of points that satisfy both descriptions at once.

Substituting the parametric line into the circle equation yields a quadratic in the parameter t whose discriminant decides the case: positive for two distinct real roots (secant), zero for a repeated root (tangent), and negative for no real roots (miss). Search intent clusters around phrases such as circle line intersection, find intersection of circle and line, tangent to a circle from a line, and secant points calculator with coordinates.

Delivering an ordered points array makes the result easy to diff in continuous integration, feed into a larger pipeline, or copy into notes. Unlike circle–circle or segment-only helpers, this landing focuses solely on an infinite line against a single circle and reports when the geometry does not meet.

Practical use, limits, pricing, and delivery channels

Use the browser tool when you want an immediate contact check while grading homework, placing a collision marker, or verifying a sketch without installing a computer-algebra system. Coordinates may be any finite numbers within a large absolute bound suitable for ordinary CAD and classroom figures; the response coordinates share the same unit system you already use.

The line is treated as infinite: intersection points may lie outside the segment between the two defining points, which is the correct classical model for analytic geometry drills and many ray-style queries that extend past a second sample point. Results are fully deterministic: the same seven numbers always yield the same points and discriminant fields. There is no language model, no external geometry service, and no randomness, so the capacity is safe to pin in continuous-integration checks and reproducible lesson materials.

If you need circle–circle intersection, segment clipping, or triangle solvers, use those dedicated landings when they exist—this capacity focuses solely on circle versus infinite line.

Homework and exam circle–line drills

Students and graders confirm tangent or secant points from center, radius, and two line points, including a clear error when the line misses the circle.

What formula does the calculator use?

It parametrizes the line through the two points, substitutes into (x−cx)²+(y−cy)²=r², and solves the quadratic using the discriminant.

Is the circle–line intersection calculator free?

The browser tool runs free on your device.

Does the tool use the finite segment between the two points?

No. The two points only define the infinite line. Intersection points may lie outside the segment; that matches classical analytic geometry.

How do I know if a line is tangent to a circle?

When the line only touches the circle, the quadratic behind the calculation has a single repeated root. The calculator then returns one point and marks it as a tangent, instead of two crossings.

What happens when the line misses the circle?

Then there are no real meeting points, because the discriminant is negative. The calculator tells you that the line and the circle do not meet rather than inventing coordinates.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/geom/circle-line-intersection

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/geom/circle-line-intersection \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cx":0,"cy":0,"r":5,"x1":-10,"y1":0,"x2":10,"y2":0}'
{
  "cx": 0,
  "cy": 0,
  "r": 5,
  "x1": -10,
  "y1": 0,
  "x2": 10,
  "y2": 0
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geom.circle_line_intersection",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

When the discriminant is non-negative it returns one or two points with a structured JSON payload; when the line misses the circle, or input is incomplete or degenerate, it fails immediately with invalid_input so failed validation is never charged.

How this calculator validates input and solves the quadratic discriminant

The radius must be strictly positive. The two line points must be distinct: a zero-length direction cannot define a unique infinite line and is rejected before any square root is taken. After parsing, the algorithm forms direction D equals (x2 minus x1, y2 minus y1) and offset F equals (x1 minus cx, y1 minus cy), then builds the quadratic coefficients a equals D dot D, b equals two times F dot D, and c equals F dot F minus r squared. The discriminant delta equals b squared minus four a c. If delta is essentially zero, one tangent point is returned with tangent set to true. Send a JSON body with the seven required fields cx, cy, r, x1, y1, x2, and y2. Each field must be a finite number (JSON numbers or numeric strings are accepted). The engine rejects missing fields, empty strings, NaN, and infinities with invalid_input so those failed calls are not charged. If delta is negative beyond a small numerical epsilon, the request fails with a clear no-intersection message because the line does not meet the circle. Results are rounded to a stable decimal precision so the same geometry always yields the same JSON across JavaScript engines. The response echoes the seven inputs, returns count, tangent, discriminant, and points, and sets method to quadratic_discriminant so callers can assert the algorithm in tests. There is no matrix inversion and no external geometry service—only arithmetic on a Worker isolate.

Practical use, limits, pricing, and delivery channels

Each successful request is one billable item at $0.002; failed validation—including a negative discriminant with no real meeting point—does not consume balance. Wire the endpoint into contest answer checkers, sprite collision helpers, CAD constraint demos, or preprocessing steps where you already prefer an explicit quadratic over opaque black-box widgets that cannot explain why a missing radius is rejected.

Deterministic fixtures for geometry and collision tests

Pipelines that seed unit tests or interactive sketch demos can call a pure intersection oracle instead of reimplementing the quadratic in every language.

CAD, survey, and game contact anchors

Tools that place markers, labels, or collision origins where a construction line meets a circular arc can recover the points as structured JSON for import.

How do I find circle–line intersection points with this API?

Send a JSON body with cx, cy, r, x1, y1, x2, and y2 to geom.circle_line_intersection. The response returns one or two points when the line meets the circle.

What happens if the line does not intersect the circle?

The request fails with invalid_input because the discriminant is negative (no real intersection). Those validation failures are not charged.

Read the full KIT documentation →