Circumcenter coordinates for a isosceles triangle [closed] - math

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I need to calculate circumcenter coordinates (or at least I hope they're called that) at point C for an isosceles triangle (the circle must be such, that created triangle is). I know the point O (origin), two vectors p and q (length may differ) originating in that point (leading to points P and Q). I also know the radius r of this to be circumscribed circle. When the circle's center is known it should create said green highlighted isosceles triangle. Here is drawing for better understanding:
Update (solution):
Calculates the length of p and q vectors
Normalize them both, and add them together
Normalize this to be OC vector again
Finally extend OC vector from point of origin O to length equivalent to radius r

Thinking geometrically:
normalise vectors p and q, i.e. p = p / |p|, q = q / |q|
add them together
normalise the result
multiply that by r - this is the vector OC
add to O
Steps 1 - 3 simply produce the bisection of the vectors p and q
EDIT this is simplified somewhat compared to my original answer.

The first equation of your system is:
(x_c-x_o)^2 + (y_c-y_o)^2 = r^2
The second one is more convoluted. You must intersect the circumference
(x-x_c)^2+(y-y_c)^2 = r^2
with your two vectors, that have equation rispectively
y = (Q_y/Q_x)*x and y = (P_y/P_x)*x
this gives you the two points of intersection p and q in function of x_c and y_c. Now force hte distance OP and OQ to be equal (you want an isoscele triangle), and you have your second equation.
Solve hte two equation system and you have the formula for x_c and y_c.
Assuming i did the math right, the solution is:
x_c = ((a+b)^2 * r^2) / ((a+b)^2+4)
y_c = (-2*(a+b) * r^2) / ((a+b)^2+4)
where
a = p_y / p_x
b = q_y / q_x

Related

How to find coordinates of a chord given one point on a circle [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
Update
I do not think this question is off topic.
The solution provided is what I was looking for and it is a programming solution.
================
I want to know how can I find the coordinates of equal chords from the same point on the circle.
As shown in the image below, I will like to choose a random point on a circle and a random chord angle (in the example its 110 degrees).
I will know the radius (r) of the circle and one randomly selected point (A) on a circle.
Based on this data, I would like to know how can I draw two equal chords from this point (AB and AC) where AB = AC.
Let you have circle center xc, yc, radius R.
At first choose random angle in range 0..2*Pi
aangle = random(2*Pi)
Then A coordinates are
ax = xc + R * Cos(aangle)
ay = yc + R * Sin(aangle)
Now choose random (or you need specific value?) chord angle in needed range and get B, C coordinates
changle = random(3 * Pi / 4)
bx = xc + R * Cos(aangle + changle)
cx = xc + R * Cos(aangle - changle) // note subtraction
and similar for Y-coordinates
If you have A coordinates, you can also rotate them around center
bx = xc + (ax - xc) * Cos(changle) - (ay - yc) * Sin(changle)
and so on

How to Make a Point Orbit a Line, 3D [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Essentially, i want to find the equation of the ring that circles a point in space, this ring is perpendicular to a normal away from this point.
I have a line, in the form of 2 points, L1, L2;
I have the normal from L1->L2, N;
I have the plane that is normal to L1->L2, which L1 lies on. ax + by + cz = d;
I have the radius away from L1, R;
-> I want to make a point V, orbit this line around point L1;
I think I have to make a circular equation in this plane with L1 as the origin. I have no idea how to plot a 2d equation onto a 3d plane.
Or maybe someone knows how to do do this another way, cross products or something?
This problem actually requires a nontrivial solution. Suppose you have U = normalize(L2 - L1) and two unit vectors V and W such that U, V, W are pairwise orthogonal.
Then f(a) = L1 + R * (V * cos(a) + W * sin(a)) for angles a is the equation for the circle you want.
How can you find W given U and V? W can just be their cross product.
How can you find V given U? This is where it's not straightforward. There are a whole circle of such V that could be chosen, so we can't just solve for "the" solution.
Here's a procedure for finding such a V. Let U = (Ux, Uy, Yz).
If Ux != 0 or Uy != 0, then V = normalize(cross(U, (0,0,1)))
Else if Ux != 0 or Uz != 0, then V = normalize(cross(U, (0,1,0)))
Else U = 0, error
Note: You can negate W if you want your point to cycle in the opposite direction.
You may use Rodrigues' Rotation Formula (try to find better description)

How to find the 3rd coordinate of a triangle [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
This is not homework. We are trying to build double connection lines between circles for a project.
Given a triangle of any type (because it will be rotated)
AB is known
AC is known
BC is known Where
AB is equal to BC (they are both the radius of the circle)
Point A is (x1,y1) and is known. It is the center point of the circle.
Point B is (x2,y2) and is known. It is the point on the edge of the circle that connects to the center of a remote circle.
Point C is unknown (x3,y3) and is what we are trying to figure out. I THINK we need to use the law of cosines, but it's not working out so far.
Thanks to anyone who can help!
You have much more info than you need to get the answer and it has nothing to do with law of cosine
Basically you only need A, B, AC, and BC
You draw a circle with A as the center and AC as the edge
You draw another circle with B as the center and BC as the edge
These two circles will have two intersecting points, and they are the two possible location of C
put it in math:
you have two Binary quadratic equations:
(x-x1)^2 + (y-y1)^2 = AC^2
(x-x2)^2 + (y-y2)^2 = BC^2
and you need to get (x, y) from these two equations
You can use the law of cosines, since you know the lengths of the three sides of the triangle (AB), (BC) and (AC). The law of cosines states that
(BC)^2 = (AC)^2 + (AB)^2 - 2 (AC)(AB) cos theta
where theta is the internal angle of the triangle at vertex A. Rearranging this gives
theta = acos(((BC)^2 - (AC)^2 - (AB)^2)/(-2 (AC)(AB)))
then your answer is (in vector notation):
(x,y) = (x1,y1) + (AC)*(v1,v2)
where (v1,v2) is the unit vector in the direction from A to C. (i.e., in scalar notation, x=x1+(AC)*v1 and y=y1+(AC)*v2). We can obtain v1 and v2 by rotating the unit vector from A to B by the angle theta:
v1 = (cos(theta)*(x2-x1) + sin(theta)*(y2-y1))/(AB)
v2 = (cos(theta)*(y2-y1) - sin(theta)*(x2-x1))/(AB)
Flip the sign of theta to get the other of the two solutions.
Note that one can avoid ever calculating theta by observing that:
cos(theta) = ((BC)^2 - (AC)^2 - (AB)^2)/(-2 (AC)(AB))
sin(theta) = sqrt(1-((BC)^2 - (AC)^2 - (AB)^2)/(-2 (AC)(AB))^2)
which may be faster to evaluate than the trigonometric functions.

Finding the angle between vectors [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Finding Signed Angle Between Vectors
I'm in need of help with a little math issue.
So, I got a vector v, representing an orientation, and two points s and t. What I what to do, is to find the rotation to apply to my vector v, in order to make it parallel with the vector defined by the two given points.
currently I'm somewhat achieving this, that is, I'm able to find the angle, just not the way to apply it (clockwise or counter clockwise).
Currently I'm just calculating the acos to the dot product of the vectors.
Any input is welcome.
Let's say acos gives you a value between 0 and pi.
Let's also say the vector from s to t is called u. As you have already computed,
acos((v . u)/(|v| * |u|))
gives you an angle alpha. Now in truth, v could be u rotated by alpha to one or the other direction.
You probably need this in 2D, but I'll go on in 3D first.
The rotation should be around a vector that is perpendicular to both v and u. This vector is of course the cross product of the two: u x v
Let's see an example:
/ v
/
/\ alpha
/ )
------------ u
In this case, u x v gives a vector towards the outside of your monitor. At the same time, you can see that the ration alpha should take place counterclockwise to make v parallel to u.
That is, in 3D, you have to compute w = u x v and always rotate v by alpha counterclockwise with respect to w. Alternatively, you can rotate v by alpha clockwise with respect to -w (which is v x u).
In 2D, I assume you want to rotate around z and you don't know which direction. You can apply the same method as above:
Compute w = u x v
If w has positive z (the x and y will be zero)
then, v should be rotated counterclockwise.
else, v should be rotated clockwise.

How do I calculate the normal vector of a line segment? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed last year.
The community reviewed whether to reopen this question 3 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Suppose I have a line segment going from (x1,y1) to (x2,y2). How do I calculate the normal vector perpendicular to the line?
I can find lots of stuff about doing this for planes in 3D, but no 2D stuff.
Please go easy on the maths (links to worked examples, diagrams or algorithms are welcome), I'm a programmer more than I'm a mathematician ;)
If we define dx = x2 - x1 and dy = y2 - y1, then the normals are (-dy, dx) and (dy, -dx).
Note that no division is required, and so you're not risking dividing by zero.
Another way to think of it is to calculate the unit vector for a given direction and then apply a 90 degree counterclockwise rotation to get the normal vector.
The matrix representation of the general 2D transformation looks like this:
x' = x cos(t) - y sin(t)
y' = x sin(t) + y cos(t)
where (x,y) are the components of the original vector and (x', y') are the transformed components.
If t = 90 degrees, then cos(90) = 0 and sin(90) = 1. Substituting and multiplying it out gives:
x' = -y
y' = +x
Same result as given earlier, but with a little more explanation as to where it comes from.
We know that: if two vectors are perpendicular, their dot product equals zero.
The normal vector (x',y') is perpendicular to the line connecting (x1,y1) and (x2,y2). This line has direction (x2-x1,y2-y1), or (dx,dy).
So,
(x',y').(dx,dy) = 0
x'.dx + y'.dy = 0
The are plenty of pairs (x',y') that satisfy the above equation. But the best pair that ALWAYS satisfies is either (dy,-dx) or (-dy,dx)
m1 = (y2 - y1) / (x2 - x1)
if perpendicular two lines:
m1*m2 = -1
then
m2 = -1 / m1 //if (m1 == 0, then your line should have an equation like x = b)
y = m2*x + b //b is offset of new perpendicular line..
b is something if you want to pass it from a point you defined

Resources