Graphics, Figures & Tablesintersections

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

intersections

Post by kent »

In PGF it is easy to let PGF find the intersection between two defined lines or intersections between one circle and a line etc.
Are there any construct in PGF, or does it exist any macro, which gives intersection between an ellipses and a line say?
Kent Holing
NORWAY

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

intersections

Post by Stefan Kottwitz »

Hi Kent,

sure, you can make an intersection of the paths, give them a name before.

If you like, post your example with the ellipse, and we will see how to exactly write this intersection.

Stefan
LaTeX.org admin
kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

intersections

Post by kent »

Code: Select all

%Say I have the below circle node c1 definition 
\coordinate (O) at (0,0);  
\coordinate (A) at (2.0,2.0);  
\coordinate [label=left:$B$] (B) at (-2.0,2.0);  
\coordinate [label=above:$S$] (S) at (2.0,3.0);  
\node (c1) [draw,red,thick,circle through=(B)] at (S) {};
%and the following ellipse definition
\draw[green,thin,] (A) ellipse (5.0cm and 2.0cm);
%how do I create a node c2 for the ellipse such that I can use
\coordinate (X) at (intersection 2 of c1 and c2);
%to get one of the intersections between the circle and the ellipse?
kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

intersections

Post by kent »

I have tried several ways to define the (c2) ellipse node, but I can't make it work.
Anybody help?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

intersections

Post by Stefan Kottwitz »

Here is an example of intersections of a circle and an ellipse.

Code: Select all

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0); 
\coordinate (A) at (2.0,2.0); 
\draw [name path = c1, red,  thick] (A) circle [radius = 4cm];
\draw [name path = c2, green, thin] (A) ellipse (5.0cm and 2.0cm);
\draw [name intersections = {of = c1 and c2}]
  (intersection-1) -- (intersection-2) -- (intersection-3)
                   -- (intersection-4) -- cycle;
\end{tikzpicture}
\end{document}
intersection.png
intersection.png (10.11 KiB) Viewed 3520 times
Stefan
LaTeX.org admin
kent
Posts: 57
Joined: Thu Oct 20, 2016 3:41 pm

intersections

Post by kent »

Thanks!
Very nice indeed. This is PGF version 3?
I see that I need to install the latest PGF version. Mine is too old for the stuff I like to do.
Kent
User avatar
Stefan Kottwitz
Site Admin
Posts: 10315
Joined: Mon Mar 10, 2008 9:44 pm

intersections

Post by Stefan Kottwitz »

Yes, I use PFG/TikZ version 3. It has been released already more than 3 years ago, so time to update. ;-) See news post with features: TikZ and PGF 3.0 released on CTAN.

Stefan
LaTeX.org admin
Post Reply