Given two coordinates of a line starting is (x1,y1) and ending is (x2,y2) find out the mid-point of a line.
Input : x1 = –1, y1 = 2, x2 = 3, y2 = –6 Output : 1,–2 Input : x1 = 6.4, y1 = 3 x2 = –10.7, y2 = 4 Output : –2.15, 3.5
The Midpoint Formula: The midpoint of two points, (x1, y2) and (x2, y2) is the point M found by the following formula: M = ((x1+x2)/2 , (y1+y2)/2)
1 , -2
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Slope of the line parallel to the line with the given slope
- Program to find line passing through 2 Points
- Program to find slope of a line
- Given n line segments, find if any two segments intersect
- Find an Integer point on a line segment with given two ends
- Find points at a given distance on a line of given slope
- Find the other end point of a line with given one end and mid
- Find foot of perpendicular from a point in 2 D plane to a Line
- Find Partition Line such that sum of values on left and right is equal
- How to check if two given line segments intersect?
- Count maximum points on same line
- Klee's Algorithm (Length Of Union Of Segments of a line)
- Line Clipping | Set 1 (Cohen–Sutherland Algorithm)
- Represent a given set of points by the best possible straight line
- Reflection of a point about a line in C++
- Check if a line touches or intersects a circle
- One line function for factorial of a number
- Section formula (Point that divides a line in given ratio)
- Number of horizontal or vertical line segments to connect 3 points
- Check if a line passes through the origin
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : jit_t