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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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 4366 times
Post Reply