

The three axes are labeled the x-axis, y-axis, and the z-axis. A 3D coordinate plane is formed by the intersection of three axes that are perpendicular to each other at the origin. 3D coordinatesĪ 3D coordinate system can be used to specify the position of a point in 3D space. 6 is the x-coordinate and 4 is the y-coordinate of the point. The position of the point in the figure below is specified by the ordered pair, (6, 4).

The coordinates are written as an ordered pair of numbers (x, y), where x indicates horizontal position and y indicates vertical position. The x- and y-coordinates indicate the position of a point in the 2D coordinate plane relative to the origin.

The two axes (plural for axis) intersect at a point called the origin. 2D coordinatesĪ 2D coordinate plane is formed by the intersection of a horizontal number line called the x-axis and a vertical number line called the y-axis. The most commonly used are the 2D (two dimensional) and 3D (three dimensional) coordinate systems. Each coordinate tells you how far the point is to the left (if it is negative) or to the right (if it is positive) of the origin. A real number that matches the location of a point along a number line is called a coordinate of the point.įor the number line above, point A has a coordinate of -5, point B has a coordinate of 1, and the coordinate for point C is 4. In mathematics, coordinates are a set of numbers that specify the position of a point in a coordinate system.Ī number line is a 1D (one dimensional) coordinate system.
Geometry x and y coordinates how to#
Here's how to find $a, b$ and $c$.Home / geometry / coordinate plane / coordinates Coordinates Note that $(P_3, P_4)$ and $(P_5, P_6)$ are interchangeable depending on which direction $(u,v)$ points. Translate $P_1$ and $P_2$ by distance $d$: So $(u, v)$ is a unit vector orthogonal to $L_1$. Normalizing this vector to have length one, we have the vector You need to translate $L_1$ along with $P_1$ and $P_2$ along the direction of a vector normal/orthogonal/perpendicular to $L_1$. (We'll see how to find $a, b$ and $c$ later.) Note that there are many tuples $(a,b,c)$ that describe the same line they're all multiples of each other. Suppose your reference (green) line $L_1$ is described by the equation $ax + by + c = 0$. Now you can simply add $\delta x$ and $\delta y$ to each of your original pairs of coordinates for the lower line, and subtract them for the upper line. By Pythagoras:Īnd the relevant adjustment factor is $i / L$, giving: First let's calculate the length of the original line, call it $L$. To convince yourself of this, draw a diagram of the square.)īut since $i$ is not in general the same as the length of the original line we need to adjust. (Note the switch in $x$ and $y$ and the negative sign for $\delta y$. Then we would be creating a square and the relevant values would be: (Make up some new names for them in your code!) Now suppose the distance $i$ between the lines was the same as the length of the original line. Let's call these $\delta x$ and $\delta y$. To find the coordinates of the ends of this line, you would need to add certain values to the old $x$ and $y$ coordinates. Now consider the parallel line that is below the original line.
Geometry x and y coordinates code#
(For clarity - these are single values and in code you could call them something like "delta_x" and "delta_y".) There are many possible approaches but I would probably use an algorithm like this:Ĭalculate the change in $x$ and the change in $y$ for the original line.
