Graphics, Figures & TablesClip Region between a Secant and a Circle

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Clip Region between a Secant and a Circle

Post by coachbennett1981 »

Hello all,

I am trying to shade the section to the right of line segment L-M. I can't figure it out with \psclip feature. If anyone can help, that would be appreciated.

Code: Select all

\documentclass[12pt]{exam}
\usepackage{amsmath,amsfonts,amssymb} 
\usepackage{pstricks}
\usepackage{pstricks-add}

\begin{document}
  \begin{pspicture}(-3,02)(2,3)
    \pscircle(0,0){2}
    \uput[l](0,0){$N$}
    \psdot[dotsize=4pt](0,0)
    \psline(0,0)(2;45)
    \psline(0,0)(2;-45)
    \psline(2;45)(2;-45)
    \uput[ur](2;45){$L$}
    \uput[r](2;-45){$M$}
    \uput[r](2,0){$120^\circ$}
  \end{pspicture}
\end{document}
Last edited by coachbennett1981 on Sun May 06, 2012 5:09 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

coachbennett1981
Posts: 274
Joined: Fri Feb 05, 2010 10:15 pm

Clip Region between a Secant and a Circle

Post by coachbennett1981 »

I used this code.

Code: Select all

\begin{psclip}{\pscircle(0,0){2}}
  \pswedge*[linecolor=lightgray](1.41,0){2}{-90}{90}
\end{psclip}
Is there an easier way? I had to use the unit circle and think a bit. But I got it.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Clip Region between a Secant and a Circle

Post by localghost »

Due to the date of this thread the solution is probably just for the record. But perhaps others who come here by search engine will find it useful.

Perhaps it is more convenient here to use a custom graphics object by \pscustom with a corresponding line style and fill color. This way you can specify the concerned area easier and more precise. The output is attached.

Code: Select all

% !TeX program = pdflatex
\documentclass[11pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}   % allow PSTricks code with PDFLaTeX
\usepackage{textcomp}

\begin{document}
  \begin{pspicture}[showgrid=false](-2,-2)(3,2)
    \pscustom[linestyle=none,fillcolor=lightgray,fillstyle=solid]{
      \psline(2;60)(2;-60)
      \psarc(0,0){2}{-60}{60}
    }
    \pscircle(0,0){2}
    \uput[l](0,0){$N$}
    \psdot[dotsize=4pt](0,0)
    \psline(0,0)(2;60)
    \psline(0,0)(2;-60)
    \psline(2;60)(2;-60)
    \uput[ur](2;60){$L$}
    \uput[dr](2;-60){$M$}
    \uput[r](2,0){120\textdegree}
  \end{pspicture}
\end{document}
Details about \pscustom can be found in the PSTricks base manual.


Thorsten
Attachments
utmp.png
utmp.png (4.44 KiB) Viewed 4307 times
Post Reply