Skip to content

Commit 9af32e9

Browse files
authored
Merge pull request #200 from rkoyama1623/add-color-option-for-draw-star
Add color option for draw star
2 parents 2a6a227 + c0ed408 commit 9af32e9

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

doc/jlatex/jgraphics.tex

+6-4
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,11 @@ \subsection{Viewer}
296296
ことによりviewsurfaceの大きさを変える。}
297297
\methoddesc{:draw-line-ndc}{ p1 p2 \&optional (do-clip t)}{
298298
NDCの中に定義される2つの端点{\em p1,p2}を結ぶ線を描く。}
299-
\methoddesc{:draw-polyline-ndc}{polylines}{
299+
\methoddesc{:draw-polyline-ndc}{polylines \&optional color}{
300300
NDCの中に定義される端点を結ぶ多角形を描く。}
301-
\methoddesc{:draw-star-ndc}{center \&optional (size 0.01)}{
301+
\methoddesc{:draw-star-ndc}{center \&optional (size 0.01) color}{
302302
NDCの中に十字マークを描く。}
303-
\methoddesc{:draw-box-ndc}{low-left up-right}{
303+
\methoddesc{:draw-box-ndc}{low-left up-right \&optional color}{
304304
NDCの中に四角形を描く。}
305305
\methoddesc{:draw-arc-ndc}{point width height angle1 angle2 \&optional color}{
306306
NDCの中に円弧を描く。
@@ -315,8 +315,10 @@ \subsection{Viewer}
315315
\metdesc{:draw-fill-rectangle-ndc}{point width height \&optional color}
316316
\methoddesc{:draw-line}{p1 p2 \&optional (do-clip t)}{
317317
ワールド座標系に定義される2つの端点{\em p1,p2}を結ぶ線を描く。}
318-
\methoddesc{:draw-star}{position \&optional (size 0.01)}{
318+
\methoddesc{:draw-star}{position \&optional (size 0.01) color}{
319319
ワールド座標系の{\em position}位置に十字マークを描く。}
320+
\methoddesc{:draw-polyline}{vlist \&optional color}{
321+
ワールド座標系の{\em vlist}端点を結ぶ多角形を描く。}
320322
\methoddesc{:draw-box}{center \&optional (size 0.01)}{
321323
ワールド座標系の{\em center}に四角形を描く。}
322324
\methoddesc{:draw-arrow}{p1 p2}{

doc/latex/graphics.tex

+6-4
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,11 @@ \subsection{Viewer}
314314
and :size message to viewport.}
315315
\methoddesc{:draw-line-ndc}{ p1 p2 \&optional (do-clip t)}{
316316
draws a line whose two end points {\em p1, p2} are defined in NDC.}
317-
\methoddesc{:draw-polyline-ndc}{polylines}{
317+
\methoddesc{:draw-polyline-ndc}{polylines \&optional color}{
318318
draws polylines whose end points are defined in NDC.}
319-
\methoddesc{:draw-star-ndc}{center \&optional (size 0.01)}{
319+
\methoddesc{:draw-star-ndc}{center \&optional (size 0.01) color}{
320320
draws a cross mark in NDC.}
321-
\methoddesc{:draw-box-ndc}{low-left up-right}{
321+
\methoddesc{:draw-box-ndc}{low-left up-right \&optional color}{
322322
draws a rectangle in NDC.}
323323
\methoddesc{:draw-arc-ndc}{point width height angle1 angle2 [color]}{
324324
draws an arc in NDC.
@@ -333,8 +333,10 @@ \subsection{Viewer}
333333
\methoddesc{:draw-line}{p1 p2 \&optional (do-clip t)}{
334334
draws a line whose two end points {\em p1, p2} are defined in the world
335335
coordinates.}
336-
\methoddesc{:draw-star}{position \&optional (size 0.01)}{
336+
\methoddesc{:draw-star}{position \&optional (size 0.01) color}{
337337
draws a cross at {\em position} located in the world.}
338+
\methoddesc{:draw-polyline}{vlist \&optional color}{
339+
draws polylines whose end points {\em vlist} are defined in the world.}
338340
\methoddesc{:draw-box}{center \&optional (size 0.01)}{
339341
draws a rectangular at {\em center}in the world.}
340342
\methoddesc{:draw-arrow}{p1 p2}{

doc/methods

+5-5
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ viewer
721721
:draw-axis (coords &optional size)
722722
:draw-body (bod &optional (normal-clip t))
723723
:draw-box (v &optional (size (/ (send surface :width) 300.0)))
724-
:draw-box-ndc (lower-left upper-right)
724+
:draw-box-ndc (lower-left upper-right color)
725725
:draw-edge (e &optional color)
726726
:draw-edge-image (ei &optional (dashed-invisibles nil) (color (send ei :color)))
727727
:draw-faces (flist &optional (normal-clip nil) color)
@@ -733,11 +733,11 @@ viewer
733733
:draw-line-ndc (p1 p2 &optional (do-clip t) (color nil))
734734
:draw-one (thing info)
735735
:draw-point-ndc (p &optional color)
736-
:draw-polyline (vlist)
737-
:draw-polyline-ndc (polyline)
736+
:draw-polyline (vlist &optional color)
737+
:draw-polyline-ndc (polyline &optional color)
738738
:draw-rectangle-ndc (point width height &optional color)
739-
:draw-star (v &optional size)
740-
:draw-star-ndc (point &optional (size 0.02))
739+
:draw-star (v &optional size color)
740+
:draw-star-ndc (point &optional (size 0.02) color)
741741
:draw-string-ndc (point string &optional color)
742742
:erase (thing)
743743
:flush

lisp/geo/viewport.l

+10-10
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@
197197
(setq width (send port :ndc-width-to-screen width))
198198
(setq height (send port :ndc-height-to-screen height))
199199
(send surface :draw-fill-arc point width height angle1 angle2))
200-
(:draw-polyline-NDC (polyline)
200+
(:draw-polyline-NDC (polyline &optional color)
201201
(let ((p1 (pop polyline)) p2)
202202
(while polyline
203203
(setq p2 (pop polyline))
204-
(send self :draw-line-NDC p1 p2 t)
204+
(send self :draw-line-NDC p1 p2 t color)
205205
(setq p1 p2))))
206-
(:draw-box-NDC (lower-left upper-right)
206+
(:draw-box-NDC (lower-left upper-right &optional color)
207207
(declare (float-vector lower-left upper-right))
208208
(let ((x1 (aref lower-left 0)) (y1 (aref lower-left 1))
209209
(x2 (aref upper-right 0)) (y2 (aref upper-right 1)))
@@ -212,13 +212,13 @@
212212
(float-vector x1 y1 0) (float-vector x2 y1 0)
213213
(float-vector x2 y2 0) (float-vector x1 y2 0)
214214
(float-vector x1 y1 0)))))
215-
(:draw-star-NDC (point &optional (size 0.02))
215+
(:draw-star-NDC (point &optional (size 0.02) (color nil))
216216
(send self :draw-line-NDC
217217
(float-vector (- (aref point 0) size) (aref point 1) 0)
218-
(float-vector (+ (aref point 0) size) (aref point 1) 0))
218+
(float-vector (+ (aref point 0) size) (aref point 1) 0) t color)
219219
(send self :draw-line-NDC
220220
(float-vector (aref point 0) (- (aref point 1) size) 0)
221-
(float-vector (aref point 0) (+ (aref point 1) size) 0))) )
221+
(float-vector (aref point 0) (+ (aref point 1) size) 0) t color)) )
222222

223223
;; drawing primitives which work in world coordinates
224224
;; First, viewing and projective transformations are applied,
@@ -234,9 +234,9 @@
234234
(setq size (float-vector size size 0.0))
235235
(setq v (homo2normal (send eye :view v)))
236236
(send self :draw-box-NDC (v- v size) (v+ v size)))
237-
(:draw-polyline (vlist)
237+
(:draw-polyline (vlist &optional color)
238238
(send self :draw-polyline-ndc
239-
(mapcar #'(lambda (x) (send eye :view x)) vlist)))
239+
(mapcar #'(lambda (x) (send eye :view x)) vlist) color))
240240
(:draw-arc (point width height
241241
&optional (angle1 0) (angle2 2pi) color
242242
&aux v)
@@ -275,9 +275,9 @@
275275
(sys:reclaim p1) (sys:reclaim p2)
276276
(sys:reclaim pn) (sys:reclaim pa) (sys:reclaim pb)))
277277
(:pane () (send self :draw-box-NDC #f(-1 -1 0) #f(1 1 0)))
278-
(:draw-star (v &optional size)
278+
(:draw-star (v &optional size color)
279279
(if (null size) (setq size 0.02))
280-
(send self :draw-star-NDC (homo2normal (send eye :view v)) size))
280+
(send self :draw-star-NDC (homo2normal (send eye :view v)) size color))
281281
(:draw-2dlnseg (l)
282282
(send self :draw-line (send l :spos) (send l :epos))) )
283283

0 commit comments

Comments
 (0)