Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!psuvax1!swatsun!jackiw From: jackiw@cs.swarthmore.edu (Nick Jackiw) Newsgroups: comp.sys.mac.programmer Subject: Re: Arrows at the end of lines... Message-ID: Date: 16 Aug 90 15:38:22 GMT References: <1320@sirius.ucs.adelaide.edu.au> Reply-To: jackiw@cs.swarthmore.edu (Nick Jackiw) Organization: Visual Geometry Project, Swarthmore College, PA Lines: 58 legg@sirius.ucs.adelaide.edu.au (Christian Legg) writes: > > Hello fellow programmers. > > I'd like to be able to draw arrow heads on the end of lines, just as > Mac Draw allows one to do. Try this. procedure DrawArrow (fromPt, toPt: Point); {By Nick Jackiw} {Given two quickdraw points, DrawArrow draws an arrowhead pointing to toPt} {in the direction facing away from fromPt.} const ArrowShaftLength=10; {How many pixels "long" the arrow-head is} ArrowHeadWidth=49; {# of degrees "wide" the arrow-head is...should be odd} var myAngle, dX, dY: integer; aRect: Rect; begin fromPt := PrimalToLocal(fromPt); toPt := PrimalToLocal(toPt); 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 top := v - ArrowShaftLength; right := h + ArrowShaftLength; bottom := v + ArrowShaftLength; left := h - ArrowShaftLength end; PaintArc(aRect, (myAngle + 180) - arrowHeadWidth div 2, arrowHeadWidth) end; -- -----Nick Jackiw [jackiw@cs.swarthmore.edu|jackiw@swarthmr.bitnet------ "This orbe of starres fixed infinitely vp extendeth hitself in altitvde sphericallye, and therefore immovable the pallace of foelicity garnished with perpetvall shining glorious lightes innvmerable." - Thomas Digges