Given an object and point relating to that object, returns a set of coords representing the same point with respect to the parent. TODO: refactor out TODO: provide more explanation, visuals?
181109
function normalizeCoords(dispObj, coords) {
    var focalAngleRad = dispObj.rotation * Math.PI / 180;
    var oppositeRad = (Math.PI - focalAngleRad) / 2;

    // Distance from register point to coords
    var relX = coords.x - dispObj.regX;
    var relY = dispObj.regY - coords.y; // opposite of cartesian
    var distFromFocal = Math.sqrt(Math.pow(relX, 2) +
                        Math.pow(relY, 2));
    if(relX < 0) distFromFocal = -distFromFocal;

    // Distance between the relative and normalized point
    var pointDistance;
    if(oppositeRad !== 0)
        pointDistance = distFromFocal * Math.sin(focalAngleRad) /
                        Math.sin(oppositeRad);
    else
        pointDistance =  distFromFocal * 2;

    var totalRelativeRad = 0;
    if(distFromFocal !== 0)
        totalRelativeRad = Math.asin(relY / distFromFocal);

    var xRad = (Math.PI / 2) - focalAngleRad - oppositeRad +
                            totalRelativeRad;

    var x = Math.sin(xRad) * pointDistance +
            coords.x - dispObj.regX + dispObj.x;
    var y = Math.cos(xRad) * pointDistance +
            coords.y - dispObj.regY + dispObj.y;

    var rotation = coords.rotation || 0;
    rotation += dispObj.rotation;

    return {
        x: x,
        y: y,
        rotation: rotation
    };
}
161646
function (x, y) {
            // Make position relative to object center point.
            x -= this.pos.x;
            y -= this.pos.y;
            // Pythagorean theorem.
            return (
                ((x * x) / this.radiusSq.x) +
                ((y * y) / this.radiusSq.y)
            ) <= 1.0;
        }
1203847
def coords_for_computations(self):
        

        # TODO: need to subtract the position offset if a Mesh (in orbit)
        if self._compute_at_vertices:
            if self.pvertices is not None:
                return self.pvertices - self._pos_center
            else:
                return self.vertices - self._pos_center
        else:
            return self.centers - self._pos_center
1352592
function (key) {
		var k = key.split(':'),
		    coords = new L.Point(+k[0], +k[1]);
		coords.z = +k[2];
		return coords;
	}
797829
function ( point ) {
            var result = {},
                m = this;
    
            result.x = m.a * point.x + m.c * point.y + m.tx;
            result.y = m.b * point.x + m.d * point.y + m.ty;
            return result;
        }
1248973
def pointInside(self, point):
        
        point = normalizers.normalizeCoordinateTuple(point)
        return self._pointInside(point)
643134
def points(self):
        
        x = vtk_to_numpy(self.GetXCoordinates())
        y = vtk_to_numpy(self.GetYCoordinates())
        z = vtk_to_numpy(self.GetZCoordinates())
        xx, yy, zz = np.meshgrid(x,y,z, indexing='ij')
        return np.c_[xx.ravel(), yy.ravel(), zz.ravel()]
539337
def _to_parent_frame(self, *args, **kwargs):
        
        lat, lon, _ = self.latlonalt
        m = rot3(-lon) @ rot2(lat - np.pi / 2.) @ rot3(self.heading)
        offset = np.zeros(6)
        offset[:3] = self.coordinates
        return self._convert(m, m), offset
860996
def aspects(self, obj):
        
        dist = angle.closestdistance(self.lon, obj.lon)
        return abs(dist) < self.orb()
935251
function() {

    var args = [];
    var n = arguments.length;
    for (var i = 0; i < n; i++) {
        args.push(arguments[i]);
    }

    if (!(this instanceof Lineto)) { // switching context of `this` to Lineto when called without `new`
        return applyToNew(Lineto, args);
    }

    if (n === 0) {
        throw new Error('Lineto constructor expects a line, 1 point, or 2 coordinates (none provided).');
    }

    var outputArray;

    if (args[0] instanceof Line) { // lines provided
        if (n === 1) {
            this.end = args[0].end.clone();
            return this;

        } else {
            throw new Error('Lineto constructor expects a line, 1 point, or 2 coordinates (' + n + ' lines provided).');
        }

    } else if (typeof args[0] === 'string' || typeof args[0] === 'number') { // coordinates provided
        if (n === 2) {
            this.end = new Point(+args[0], +args[1]);
            return this;

        } else if (n < 2) {
            throw new Error('Lineto constructor expects a line, 1 point, or 2 coordinates (' + n + ' coordinates provided).');

        } else { // this is a poly-line segment
            var segmentCoords;
            outputArray = [];
            for (i = 0; i < n; i += 2) { // coords come in groups of two

                segmentCoords = args.slice(i, i + 2); // will send one coord if args.length not divisible by 2
                outputArray.push(applyToNew(Lineto, segmentCoords));
            }
            return outputArray;
        }

    } else { // points provided (needs to be last to also cover plain objects with x and y)
        if (n === 1) {
            this.end = new Point(args[0]);
            return this;

        } else { // this is a poly-line segment
            var segmentPoint;
            outputArray = [];
            for (i = 0; i < n; i += 1) {

                segmentPoint = args[i];
                outputArray.push(new Lineto(segmentPoint));
            }
            return outputArray;
        }
    }
}
1065875
def coords
      x, y, z = Array.new, Array.new, Array.new
      @coordinates.each do |coord|
        x << coord.x
        y << coord.y
        z << coord.z
      end
      return x, y, z
    end
937954
def _scale_coords(self, x, y, extent, xo, yo):
        """"""
        return xo + (x * self._size * 2 / extent), yo + ((extent - y) * self._size / extent)
935818
def +(p)
    if p.is_a?Point
      @coord[:x] += p.x
      @coord[:y] += p.y
      @coord[:z] += p.z if p.z or @coord[:z]
    elsif p.is_a?Numeric
      @coord[:x] += p
      @coord[:y] += p
      @coord[:z] += p if @coord[:z]
    else
      MyError::Error.call "Point::+ : passed argument is invalid (#{p.class})"
    end
    return self
  end
302831
def positions(self, x, y):
        # type: (int, int) -> List[(Point, Point)]
        
        return [(Point(x, v), Point(x + 1 + v, y - 1 - v)) for v in range(y)]
115069
def point_in_polygon(point, poly):
    
    coords = [poly['coordinates']] if poly[
        'type'] == 'Polygon' else poly['coordinates']
    return _point_in_polygon(point, coords)
775347
def get_coord_box(centre_x, centre_y, distance):
    """Todo: return coordinates inside a circle, rather than a square"""
    return {
        'top_left': (centre_x - distance, centre_y + distance),
        'top_right': (centre_x + distance, centre_y + distance),
        'bottom_left': (centre_x - distance, centre_y - distance),
        'bottom_right': (centre_x + distance, centre_y - distance),
    }
319771
function(obj) {
    if (obj.normal) { return obj.distanceFrom(this); }
    if (obj.direction) {
      // obj is a line
      if (this.isParallelTo(obj)) { return this.distanceFrom(obj.anchor); }
      var N = this.direction.cross(obj.direction).toUnitVector().elements;
      var A = this.anchor.elements, B = obj.anchor.elements;
      return Math.abs((A[0] - B[0]) * N[0] + (A[1] - B[1]) * N[1] + (A[2] - B[2]) * N[2]);
    } else {
      // obj is a point
      var P = obj.elements || obj;
      var A = this.anchor.elements, D = this.direction.elements;
      var PA1 = P[0] - A[0], PA2 = P[1] - A[1], PA3 = (P[2] || 0) - A[2];
      var modPA = Math.sqrt(PA1*PA1 + PA2*PA2 + PA3*PA3);
      if (modPA === 0) return 0;
      // Assumes direction vector is normalized
      var cosTheta = (PA1 * D[0] + PA2 * D[1] + PA3 * D[2]) / modPA;
      var sin2 = 1 - cosTheta*cosTheta;
      return Math.abs(modPA * Math.sqrt(sin2 < 0 ? 0 : sin2));
    }
  }