Syntax
[w1,w2,dw,Q1,Q2]=wofcross2circ(A0,B0,r1,r2)
Input Parameter
A0 : | | Center of circle A |
B0 : | | Center of circle B |
r1 : | | radius of circle A |
r2 : | | radius of circle B |
Output Parameter
w1 : | | absolute angle of Q1 angle relative to A0 |
w2 : | | absolute angle of Q2 angle relative to B0 |
dw : | | angle of direction B0-A0 |
Q1 : | | cross point 1 |
Q2 : | | cross point 1 |
Examples
try
wofcross2circ([0 0],[4 0],4,2) % 2 Solutions
wofcross2circ([0 0],[4 0],2,2) % 1 Solution
wofcross2circ([0 0],[4 0],1,6) % No Solution
Copyright 2019-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function calculates the intersection points of two circles and their respective angles.
Input Parameters
- A0: Center of circle A, a 2D vector.
- B0: Center of circle B, a 2D vector.
- r1: Radius of circle A.
- r2: Radius of circle B.
Output Results
- w1: Absolute angle of intersection point Q1 relative to A0.
- w2: Absolute angle of intersection point Q2 relative to B0.
- dw: Angle of direction from B0 to A0.
- Q1: First intersection point.
- Q2: Second intersection point.
Algorithm Steps
- Call the function
cross2circ
with inputs A0
, B0
, r1
, and r2
to compute the intersection points Q1
and Q2
.
- Calculate the vector
D
as the difference between A0
and B0
.
- Compute vectors
q1
and q2
as the differences between Q1
, Q2
, and A0
respectively.
- Calculate angles
w1
and w2
using the atan2
function on q1
and q2
.
- Calculate the angle
dw
using the atan2
function on D
.
- If no output is requested, plot the circles and intersection points using the
aplot
and textP
functions.
Example Usage
wofcross2circ([0 0],[4 0],4,2)
: Two solutions.
wofcross2circ([0 0],[4 0],2,2)
: One solution.
wofcross2circ([0 0],[4 0],1,6)
: No solution.
Algorithm explaination created using ChatGPT on 2025-08-19 07:41. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21