Get the current origin position.

    This point moves when :any:`path_walk` returns the next x,y step.

    Args:
        p (AStar): An AStar instance.
    Returns:
        Tuple[int, int]: An (x, y) point.
501947
def path_get_origin(p: tcod.path.AStar) -> Tuple[int, int]:
    
    x = ffi.new("int *")
    y = ffi.new("int *")
    lib.TCOD_path_get_origin(p._path_c, x, y)
    return x[0], y[0]
909796
def getBottomRight(self):
        
        return Location(self.x+self.w, self.y+self.h)
275646
function getPath(points) {
    var p, contours, i, realFirstPoint, j, contour, pt, firstPt,
        prevPt, midPt, curvePt, lastPt;
    p = new path.Path();
    if (!points) {
        return p;
    }
    contours = getContours(points);
    for (i = 0; i < contours.length; i += 1) {
        contour = contours[i];
        firstPt = contour[0];
        lastPt = contour[contour.length - 1];
        if (firstPt.onCurve) {
            curvePt = null;
            // The first point will be consumed by the moveTo command,
            // so skip it in the loop.
            realFirstPoint = true;
        } else {
            if (lastPt.onCurve) {
                // If the first point is off-curve and the last point is on-curve,
                // start at the last point.
                firstPt = lastPt;
            } else {
                // If both first and last points are off-curve, start at their middle.
                firstPt = { x: (firstPt.x + lastPt.x) / 2, y: (firstPt.y + lastPt.y) / 2 };
            }
            curvePt = firstPt;
            // The first point is synthesized, so don't skip the real first point.
            realFirstPoint = false;
        }
        p.moveTo(firstPt.x, firstPt.y);

        for (j = realFirstPoint ? 1 : 0; j < contour.length; j += 1) {
            pt = contour[j];
            prevPt = j === 0 ? firstPt : contour[j - 1];
            if (prevPt.onCurve && pt.onCurve) {
                // This is a straight line.
                p.lineTo(pt.x, pt.y);
            } else if (prevPt.onCurve && !pt.onCurve) {
                curvePt = pt;
            } else if (!prevPt.onCurve && !pt.onCurve) {
                midPt = { x: (prevPt.x + pt.x) / 2, y: (prevPt.y + pt.y) / 2 };
                p.quadraticCurveTo(prevPt.x, prevPt.y, midPt.x, midPt.y);
                curvePt = pt;
            } else if (!prevPt.onCurve && pt.onCurve) {
                // Previous point off-curve, this point on-curve.
                p.quadraticCurveTo(curvePt.x, curvePt.y, pt.x, pt.y);
                curvePt = null;
            } else {
                throw new Error('Invalid state.');
            }
        }
        if (firstPt !== lastPt) {
            // Connect the last and first points
            if (curvePt) {
                p.quadraticCurveTo(curvePt.x, curvePt.y, firstPt.x, firstPt.y);
            } else {
                p.lineTo(firstPt.x, firstPt.y);
            }
        }
    }
    p.closePath();
    return p;
}
178395
function forward$6(p) {
        var lon = p.x;
        var lat = p.y;
        var sinlat = Math.sin(lat);
        var coslat = Math.cos(lat);
        var A, X, sinX, cosX, ts, rh;
        var dlon = adjust_lon(lon - this.long0);

        if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
            //case of the origine point
            //trace('stere:this is the origin point');
            p.x = NaN;
            p.y = NaN;
            return p;
        }
        if (this.sphere) {
            //trace('stere:sphere case');
            A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
            p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
            p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
            return p;
        }
        else {
            X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
            cosX = Math.cos(X);
            sinX = Math.sin(X);
            if (Math.abs(this.coslat0) <= EPSLN) {
                ts = tsfnz(this.e, lat * this.con, this.con * sinlat);
                rh = 2 * this.a * this.k0 * ts / this.cons;
                p.x = this.x0 + rh * Math.sin(lon - this.long0);
                p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
                //trace(p.toString());
                return p;
            }
            else if (Math.abs(this.sinlat0) < EPSLN) {
                //Eq
                //trace('stere:equateur');
                A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
                p.y = A * sinX;
            }
            else {
                //other case
                //trace('stere:normal case');
                A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
                p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
            }
            p.x = A * cosX * Math.sin(dlon) + this.x0;
        }
        //trace(p.toString());
        return p;
    }
1291191
def get(self, point):
        
        if not (isinstance(point, GeoVector) and point.type == 'Point'):
            raise TypeError('expect GeoVector(Point), got %s' % (point,))

        target = self.to_raster(point)
        return self.image[:, int(target.y), int(target.x)]
1091508
def getP2(self):
        
        return Point(self.center[0] + self.radius,
                     self.center[1] + self.radius)
827113
def GetDirections(self, origin, destination, sensor = False, mode = None, waypoints = None, alternatives  = None, avoid = None, language  = None, units = None,
                        region = None, departure_time  = None, arrival_time = None):
        '''
        '''
        
        params = {
            'origin': origin,
            'destination': destination,
            'sensor': str(sensor).lower()
        }

        
        if mode:
            params['mode'] = mode
            
        if waypoints:
            params['waypoints'] = waypoints
            
        if alternatives:
            params['alternatives'] = alternatives
            
        if avoid:
            params['avoid'] = avoid
            
        if language:
            params['language'] = language
            
        if units:
            params['units'] = units
            
        if region:
            params['region'] = region
            
        if departure_time:
            params['departure_time'] = departure_time
            
        if arrival_time:
            params['arrival_time'] = arrival_time
        
        
        if not self.premier:
            url = self.get_url(params)
        else:
            url = self.get_signed_url(params)

        return self.GetService_url(url)
1351452
def find_start_point(self):
        
        for i, row in enumerate(self.data):
            for j, _ in enumerate(row):
                if self.data[i, j] != 0:  # or not np.isfinite(self.data[i,j]):
                    return i, j
665545
def D(self):
        '''
        
        '''
        return Point(self.minX, self.maxY, self.origin.z)
722144
public static int crossPath (PathIterator p, float x, float y) {
        int cross = 0;
        float mx, my, cx, cy;
        mx = my = cx = cy = 0f;
        float[] coords = new float[6];

        while (!p.isDone()) {
            switch (p.currentSegment(coords)) {
            case PathIterator.SEG_MOVETO:
                if (cx != mx || cy != my) {
                    cross += crossLine(cx, cy, mx, my, x, y);
                }
                mx = cx = coords[0];
                my = cy = coords[1];
                break;
            case PathIterator.SEG_LINETO:
                cross += crossLine(cx, cy, cx = coords[0], cy = coords[1], x, y);
                break;
            case PathIterator.SEG_QUADTO:
                cross += crossQuad(cx, cy, coords[0], coords[1], cx = coords[2], cy = coords[3], x,
                        y);
                break;
            case PathIterator.SEG_CUBICTO:
                cross += crossCubic(cx, cy, coords[0], coords[1], coords[2], coords[3],
                        cx = coords[4], cy = coords[5], x, y);
                break;
            case PathIterator.SEG_CLOSE:
                if (cy != my || cx != mx) {
                    cross += crossLine(cx, cy, cx = mx, cy = my, x, y);
                }
                break;
            }

            // checks if the point (x,y) is the vertex of shape with PathIterator p
            if (x == cx && y == cy) {
                cross = 0;
                cy = my;
                break;
            }
            p.next();
        }
        if (cy != my) {
            cross += crossLine(cx, cy, mx, my, x, y);
        }
        return cross;
    }
1222029
def position_p(self):
        
        self._position_p, value = self.get_attr_int(self._position_p, 'hold_pid/Kp')
        return value
1129394
def get_intended_direction(self):
        
        x = 0
        y = 0
        if self.target_x == self.current_x and self.target_y == self.current_y:
            return y,x  # target already acquired
        if self.target_y > self.current_y:
            y = 1
        elif self.target_y < self.current_y:
            y = -1
        if self.target_x > self.current_x:
            x = 1
        elif self.target_x < self.current_x:
            x = -1
        return y,x
697355
def get_movement_delta(self):
        """"""
        pos = self.pan - self.previous_pos
        self.previous_pos = Vector2(self.pan.X, self.pan.Y)
        return pos
455328
public Result<List<StraightPathItem>> findStraightPath(float[] startPos, float[] endPos, List<Long> path,
            int maxStraightPath, int options) {

        List<StraightPathItem> straightPath = new ArrayList<>();
        if (Objects.isNull(startPos) || !vIsFinite(startPos) || Objects.isNull(endPos) || !vIsFinite(endPos)
                || Objects.isNull(path) || path.isEmpty() || path.get(0) == 0 || maxStraightPath <= 0) {
            return Result.invalidParam();
        }
        // TODO: Should this be callers responsibility?
        Result<float[]> closestStartPosRes = closestPointOnPolyBoundary(path.get(0), startPos);
        if (closestStartPosRes.failed()) {
            return Result.invalidParam("Cannot find start position");
        }
        float[] closestStartPos = closestStartPosRes.result;
        Result<float[]> closestEndPosRes = closestPointOnPolyBoundary(path.get(path.size() - 1), endPos);
        if (closestEndPosRes.failed()) {
            return Result.invalidParam("Cannot find end position");
        }
        float[] closestEndPos = closestEndPosRes.result;
        // Add start point.
        Status stat = appendVertex(closestStartPos, DT_STRAIGHTPATH_START, path.get(0), straightPath, maxStraightPath);
        if (!stat.isInProgress()) {
            return Result.success(straightPath);
        }

        if (path.size() > 1) {
            float[] portalApex = vCopy(closestStartPos);
            float[] portalLeft = vCopy(portalApex);
            float[] portalRight = vCopy(portalApex);
            int apexIndex = 0;
            int leftIndex = 0;
            int rightIndex = 0;

            int leftPolyType = 0;
            int rightPolyType = 0;

            long leftPolyRef = path.get(0);
            long rightPolyRef = path.get(0);

            for (int i = 0; i < path.size(); ++i) {
                float[] left;
                float[] right;
                int toType;

                if (i + 1 < path.size()) {
                    // Next portal.
                    Result<PortalResult> portalPoints = getPortalPoints(path.get(i), path.get(i + 1));
                    left = portalPoints.result.left;
                    right = portalPoints.result.right;
                    toType = portalPoints.result.toType;
                    if (portalPoints.failed()) {
                        closestEndPosRes = closestPointOnPolyBoundary(path.get(i), endPos);
                        if (closestEndPosRes.failed()) {
                            return Result.invalidParam();
                        }
                        closestEndPos = closestEndPosRes.result;
                        // Append portals along the current straight path segment.
                        if ((options & (DT_STRAIGHTPATH_AREA_CROSSINGS | DT_STRAIGHTPATH_ALL_CROSSINGS)) != 0) {
                            // Ignore status return value as we're just about to return anyway.
                            appendPortals(apexIndex, i, closestEndPos, path, straightPath, maxStraightPath, options);
                        }
                        // Ignore status return value as we're just about to return anyway.
                        appendVertex(closestEndPos, 0, path.get(i), straightPath, maxStraightPath);
                        return Result.success(straightPath);
                    }

                    // If starting really close the portal, advance.
                    if (i == 0) {
                        Tupple2<Float, Float> dt = distancePtSegSqr2D(portalApex, left, right);
                        if (dt.first < sqr(0.001f)) {
                            continue;
                        }
                    }
                } else {
                    // End of the path.
                    left = vCopy(closestEndPos);
                    right = vCopy(closestEndPos);
                    toType = Poly.DT_POLYTYPE_GROUND;
                }

                // Right vertex.
                if (triArea2D(portalApex, portalRight, right) <= 0.0f) {
                    if (vEqual(portalApex, portalRight) || triArea2D(portalApex, portalLeft, right) > 0.0f) {
                        portalRight = vCopy(right);
                        rightPolyRef = (i + 1 < path.size()) ? path.get(i + 1) : 0;
                        rightPolyType = toType;
                        rightIndex = i;
                    } else {
                        // Append portals along the current straight path segment.
                        if ((options & (DT_STRAIGHTPATH_AREA_CROSSINGS | DT_STRAIGHTPATH_ALL_CROSSINGS)) != 0) {
                            stat = appendPortals(apexIndex, leftIndex, portalLeft, path, straightPath, maxStraightPath,
                                    options);
                            if (!stat.isInProgress()) {
                                return Result.success(straightPath);
                            }
                        }

                        portalApex = vCopy(portalLeft);
                        apexIndex = leftIndex;

                        int flags = 0;
                        if (leftPolyRef == 0) {
                            flags = DT_STRAIGHTPATH_END;
                        } else if (leftPolyType == Poly.DT_POLYTYPE_OFFMESH_CONNECTION) {
                            flags = DT_STRAIGHTPATH_OFFMESH_CONNECTION;
                        }
                        long ref = leftPolyRef;

                        // Append or update vertex
                        stat = appendVertex(portalApex, flags, ref, straightPath, maxStraightPath);
                        if (!stat.isInProgress()) {
                            return Result.success(straightPath);
                        }

                        portalLeft = vCopy(portalApex);
                        portalRight = vCopy(portalApex);
                        leftIndex = apexIndex;
                        rightIndex = apexIndex;

                        // Restart
                        i = apexIndex;

                        continue;
                    }
                }

                // Left vertex.
                if (triArea2D(portalApex, portalLeft, left) >= 0.0f) {
                    if (vEqual(portalApex, portalLeft) || triArea2D(portalApex, portalRight, left) < 0.0f) {
                        portalLeft = vCopy(left);
                        leftPolyRef = (i + 1 < path.size()) ? path.get(i + 1) : 0;
                        leftPolyType = toType;
                        leftIndex = i;
                    } else {
                        // Append portals along the current straight path segment.
                        if ((options & (DT_STRAIGHTPATH_AREA_CROSSINGS | DT_STRAIGHTPATH_ALL_CROSSINGS)) != 0) {
                            stat = appendPortals(apexIndex, rightIndex, portalRight, path, straightPath,
                                    maxStraightPath, options);
                            if (!stat.isInProgress()) {
                                return Result.success(straightPath);
                            }
                        }

                        portalApex = vCopy(portalRight);
                        apexIndex = rightIndex;

                        int flags = 0;
                        if (rightPolyRef == 0) {
                            flags = DT_STRAIGHTPATH_END;
                        } else if (rightPolyType == Poly.DT_POLYTYPE_OFFMESH_CONNECTION) {
                            flags = DT_STRAIGHTPATH_OFFMESH_CONNECTION;
                        }
                        long ref = rightPolyRef;

                        // Append or update vertex
                        stat = appendVertex(portalApex, flags, ref, straightPath, maxStraightPath);
                        if (!stat.isInProgress()) {
                            return Result.success(straightPath);
                        }

                        portalLeft = vCopy(portalApex);
                        portalRight = vCopy(portalApex);
                        leftIndex = apexIndex;
                        rightIndex = apexIndex;

                        // Restart
                        i = apexIndex;

                        continue;
                    }
                }
            }

            // Append portals along the current straight path segment.
            if ((options & (DT_STRAIGHTPATH_AREA_CROSSINGS | DT_STRAIGHTPATH_ALL_CROSSINGS)) != 0) {
                stat = appendPortals(apexIndex, path.size() - 1, closestEndPos, path, straightPath, maxStraightPath,
                        options);
                if (!stat.isInProgress()) {
                    return Result.success(straightPath);
                }
            }
        }

        // Ignore status return value as we're just about to return anyway.
        appendVertex(closestEndPos, DT_STRAIGHTPATH_END, 0, straightPath, maxStraightPath);
        return Result.success(straightPath);
    }
106629
public Point getLegendPosition(int lineNr, int chainNr) {
		int x = DEFAULT_X_SPACE ;

		int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE;

		y += chainNr * DEFAULT_LINE_SEPARATION;

		Point p = new Point(x,y);
		return p;
	}
486528
def _last_in_direction(starting_pos, direction):
        
        cur_pos = None
        next_pos = starting_pos
        while next_pos is not None:
            cur_pos = next_pos
            next_pos = direction(cur_pos)
        return cur_pos
263276
def get_pt(self, viewer, points, pt, canvas_radius=None):
        
        if canvas_radius is None:
            canvas_radius = self.cap_radius

        if hasattr(self, 'rot_deg'):
            # rotate point back to cartesian alignment for test
            ctr_pt = self.get_center_pt()
            pt = trcalc.rotate_coord(pt, [-self.rot_deg], ctr_pt)

        res = self.within_radius(viewer, points, pt, canvas_radius)
        return np.flatnonzero(res)