## Number of Integral Points between Two Points

Given two points p (x1, y1) and q (x2, y2), calculate the number of integral points lying on the line joining them. Example : If… Read More »

## Count Integral points inside a Triangle

Given three non-collinear integral points in XY plane, find the number of integral points inside the triangle formed by the three points. (A point in… Read More »

## Orientation of 3 ordered points

Orientation of an ordered triplet of points in the plane can be counterclockwise clockwise colinear The following diagram shows different possible orientations of (a,b,c) If… Read More »

## Find Simple Closed Path for a given set of points

Given a set of points, connect the dots without crossing. Example: Input: points[] = {(0, 3), (1, 1), (2, 2), (4, 4), (0, 0), (1,… Read More »

## How to check if given four points form a square

Given coordinates of four points in a plane, find if the four points form a square or not. To check for square, we need to… Read More »

## Minimum Cost Polygon Triangulation

A triangulation of a convex polygon is formed by drawing diagonals between non-adjacent vertices (corners) such that the diagonals never intersect. The problem is to… Read More »

## Program to find area of a circle

Area of a circle can simply be evaluated using following formula. Area = pi * r2 where r is radius of circle Recommended: Please solve… Read More »

## Program to find area of a triangle

Finding area using given sides: Examples : Input : a = 5, b = 7, c = 8 Output : Area of a triangle is… Read More »

## Find if two rectangles overlap

Given two rectangles, find if the given two rectangles overlap or not. Note that a rectangle can be represented by two coordinates, top left and… Read More »

## Closest Pair of Points | O(nlogn) Implementation

We are given an array of n points in the plane, and the problem is to find out the closest pair of points in the… Read More »

## Given n line segments, find if any two segments intersect

We have discussed the problem to detect if two given line segments intersect or not. In this post, we extend the problem. Here we are… Read More »

## Convex Hull | Set 2 (Graham Scan)

Given a set of points in the plane. the convex hull of the set is the smallest convex polygon that contains all the points of… Read More »

## Convex Hull | Set 1 (Jarvis’s Algorithm or Wrapping)

Given a set of points in the plane. the convex hull of the set is the smallest convex polygon that contains all the points of… Read More »

## How to check if a given point lies inside or outside a polygon?

Given a polygon and a point ‘p’, find if ‘p’ lies inside the polygon or not. The points lying on the border are considered inside.… Read More »

## How to check if two given line segments intersect?

Given two line segments (p1, q1) and (p2, q2), find if the given line segments intersect with each other. Before we discuss solution, let us… Read More »