Index of Tangential Circles and Arcs
- 1. Introduction
- 2. Tangential Circles on Lines
- 3. Tangential Circles on Line and Circle
- 4. Tangential Circles on Circles
1. Introduction
The ZeusMath Library contains a complete implementation to get tangetial circles and arcs between different elements. A tangential circle or arc can be established between
- two straight lines
- a straight line and a circle
- two circles
- two lines segments
- a line segment and an arc
- two arcs
2. Tangential Circles on Lines
There exist three sets of solutions:
- (a) 4 tangential circles if the lines have an intersection
- (b) infinit number of tangential circles if the lines are parallel and the distance between them is equal to the diameter of the circle
- (c) no tangential circle if the lines are parallel and the distance between them is different to the diameter of the circle
2.1 Implementation
The implementation is available in the sub package zeusmath/Geometry
using the classes TCircle2D
,TStraightLine2D
, TArc2D
and TLineSegment2D
.
#include <zeusmath/Geometry/Circle2D.h>
#include <zeusmath/Geometry/StraightLine2D.h>¨
...
TStraightLine2D Sl1(TVector2D(0, 0), TVector2D(1, 0), true);
TStraightLine2D Sl2(TVector2D(0, 2), TVector2D(1, 0), true);
TCircle2D Circle1;
TCircle2D Circle2;
TCircle2D Circle3;
TCircle2D Circle4;
if(TCircle2D::calcCirclesTangentTo2StraightLines(Sl3, //First line
Sl4, //Second line
23.4, //Tangential radius
Circle1, //4 solutions
Circle2,
Circle3,
Circle4) == RET_NOERROR)
{
...
}
The line segments are lines which are limited between two vectors, start and end points. This constrains the possible solutions of tangential circles. Their touch points must be inside the start and end point.
#include <zeusmath/Geometry/Circle2D.h>
#include <zeusmath/Geometry/LineSegment2D.h>
...
TLineSegment2D LineSegment1(TVector2D(2, 1), TVector2D(0, 3));
TLineSegment2D LineSegment2(TVector2D(3, 1), TVector2D(4, 4));
Float R = 1.5;
TValueTypeList<TCircle2D, ICircle2D> lstTangentCircles;
if (TCircle2D::calcCirclesTangentTo2LineSegments(LineSegment1,
LineSegment2,
1.5,
lstTangentCircles))
{
...
}
3. Tangential Circles on Line and Circle
There exist eight sets of solutions:
- (a) 8 tangential circles
- (b) 7 tangential circles
- (c) 6 tangential circles
- (d) 5 tangential circles
- (e) 4 tangential circles
- (f) 2 tangential circles if the line and the circle don't intersect but are closer than the diameter of the tangential circle
- (g) 1 tangential circle if the distance between the line and the circle equals the diameter of the tangential circle
- (h) no tangential circle if the distance between the line and the circle is larger than the diameter of the tangential circle.
3.1 Implementation
#include <zeusmath/Geometry/Circle2D.h>
#include <zeusmath/Geometry/StraightLine2D.h>
#include <zeusbase/System/ValueTypeList.hpp>
...
TStraightLine2D Sl(TVector2D(3, 0), TVector2D(-3, 2), true);
TValueTypeList<TCircle2D, ICircle2D> lstTangentCircles;
TCircle2D Circle1(TVector2D(2, 2.5), 4);
if (TCircle2D::calcCirclesTangentToStraightLineAndCircle(Sl,
Circle1,
0.75,
lstTangentCircles))
{
...
//List contains all solutions
}
The possible solutions of tangential circles are constraint by the line segment and the arc, which both starts at the starting point and end at the end point.
#include <zeusmath/Geometry/Circle2D.h>
#include <zeusmath/Geometry/LineSegment2D.h>
#include <zeusmath/Geometry/Arc2D.h>
#include <zeusbase/System/ValueTypeList.hpp>
...
TLineSegment2D Ls(TVector2D(1, 2), TVector2D(4, 2));
TArc2D Arc(TVector2D(5, 2),
1,
TAngle(180, IAngle::etDegrees),
TAngle(270, IAngle::etDegrees), true);
TValueTypeList<TCircle2D, ICircle2D> lstTangentCircles;
If(TCircle2D::calcCirclesTangentToLineSegmentAndArc(Ls,
Arc,
2,
lstTangentCircles))
{
...
//List contains all solutions
}
4. Tangential Circles on Circles
There exist ten sets of solutions:
- (a) 8 tangential circles
- (b) 7 tangential circles
- (c) 6 tangential circles
- (d) 5 tangential circles
- (e) 4 tangential circles
- (f) 3 tangential circles
- (g) 2 tangential circles
- (h) 1 tangential circle if the distance between the circles equals the diameter of the tangential circle
- (i) no tangential circle if the distance between the circles is larger than the diameter of the tangential circle.
- (j) infinite number of tangential circles if the two circles are concentric.
4.1 Implementation
#include <zeusmath/Geometry/Circle2D.h>
#include <zeusbase/System/ValueTypeList.hpp>
...
TCircle2D A(TVector2D(-2.5, 5), 4);
TCircle2D B(TVector2D(6, 2), 6.5);
TValueTypeList<TCircle2D, ICircle2D> lstTangentCircles;
if(TCircle2D::calcCirclesTangentTo2Circles(A,
B,
0.5,
lstTangentCircles))
{
...
//List contains all solutions
}
#include <zeusmath/Geometry/Circle2D.h>
#include <zeusmath/Geometry/Arc2D.h>
#include <zeusbase/System/ValueTypeList.hpp>
...
TArc2D Arc1(TVector2D(0, 1),
1,
TAngle( 90, IAngle::etDegrees),
TAngle( 0, IAngle::etDegrees),
false);
TArc2D Arc2(TVector2D(3, 1),
2,
TAngle(180, IAngle::etDegrees),
TAngle(270, IAngle::etDegrees),
true);
Float R = 1.5;
TValueTypeList<TCircle2D, ICircle2D> lstTangentCircles;
if(TCircle2D::calcCirclesTangentTo2Arcs(Arc1,
Arc2,
R,
lstTangentCircles))
{
...
//List contains all solutions
}