• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SciKit-Surgery / scikit-surgerycore / 1

29 Dec 2024 12:45PM UTC coverage: 97.927% (-0.3%) from 98.203%
1

push

github

MattClarkson
Merge branch '75-load-slicer-points'

5 of 27 new or added lines in 1 file covered. (18.52%)

488 existing lines in 15 files now uncovered.

614 of 627 relevant lines covered (97.93%)

9.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/sksurgerycore/algorithms/vector_math.py
1
# -*- coding: utf-8 -*-
2

3
""" Various small maths utilities. """
4

5
import numpy as np
11✔
6

7

8
def distance_from_line(p_1, p_2, p_3):
11✔
9
    """
10
    Computes distance of a point p_3, from a line defined by p_1 and p_2.
11

12
    See `here <https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line>`_.
13

14
    :return: euclidean distance
15
    """
16
    # I want notation same as wikipedia page, so disabling warning.
17
    # pylint: disable=invalid-name
UNCOV
18
    n = p_2 - p_1
10✔
UNCOV
19
    n = n / np.linalg.norm(n)
10✔
UNCOV
20
    a_minus_p = p_1 - p_3
10✔
UNCOV
21
    vector_to_line = a_minus_p - (np.dot(a_minus_p, n) * n)
10✔
UNCOV
22
    distance = np.linalg.norm(vector_to_line)
10✔
UNCOV
23
    return distance
10✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc