Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!decwrl!pacbell.com!pacbell!well!smoke From: smoke@well.sf.ca.us (Nicholas Jackiw) Newsgroups: comp.sys.mac.programmer Subject: Re: Arrowheads anyone? Message-ID: <23497@well.sf.ca.us> Date: 8 Mar 91 18:25:33 GMT References: <2867@krafla.rhi.hi.is> <1991Mar5.190538.778@csn.org> Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 51 In article <1991Mar5.190538.778@csn.org> bernard@cs.colorado.edu (Bernie Bernstein) writes: > * ArrowPoints >I wrote this in Think C a long time ago. I would be interested in hearing >from others who have faster ways to do this. > o, ,, , | Bernie Bernstein | , ,, This Pascal frag cuts down on all the trig (or rather, delegates it to the Toolbox): procedure DrawArrow (fromPt, toPt: Point); {Given two points, DrawArrow draws an arrowhead pointing to toPt.} {The pixel-length of the arrowhead is specified by ELineInset.} const ELineInset=10; var myAngle, dX, dY: integer; aRect: Rect; begin with fromPt do begin with aRect do begin left := h - 100; top := v - 100; right := h + 100; bottom := v + 100 end; PtToAngle(aRect, toPt, myAngle) end; with toPt do with aRect do begin dX := ELineInset; top := v - dX; right := h + dX; bottom := v + dX; left := h - dX; end; PaintArc(aRect, (myAngle + 180) - 24, 49) ; Total Arrow Arc=50 degrees end; -- --- * --- Nicholas Jackiw Smoke@well.sf.ca.us | Jackiw@cs.swarthmore.edu Key Curriculum Press, Inc. Applelink: D3970 | (415) 548-2304 --- * ---