• To: mathgroup at smc.vnet.net
• Subject: [mg79862] Re: gamepad graphics
• From: zzzz <giarc54 at gmail.com>
• Date: Tue, 7 Aug 2007 01:30:20 -0400 (EDT)
• References: <200708050856.EAA22603@smc.vnet.net><f96jqe\$qg3\$1@smc.vnet.net>

```On Aug 6, 12:49 am, Murray Eisenberg <mur... at math.umass.edu> wrote:
> Something is wrong in your code syntactically with the Print[]
> expression after you remove the comments around it (even after one
> inserts an apparently missing comma after Print[] in the 2D case).
>
>
>
> zzzz wrote:
> > I wrote a program that is supposed to use my Logitech
> > gamepad (for ps3) to control a point so that as it aproaches
> > a disk, the hue of the disk will change.
> > Curiously,(to me anyway) this programs works (kind of) only when a
> > print command is inserted as below:
>
> > DynamicModule[{x = -400, y = -400, d = 1000, a = .5},
> >  ControllerManipulate[
>
> >   Graphics[{{Hue[Dynamic[a]], Disk[{0, 0}, 200]}, {PointSize[Large],
> >      Point[{x, y}]}}, Axes -> True, PlotRange -> 1000,
> >    AspectRatio -> 1/1, ImageSize -> {500, 500}],
> >   Dynamic[x = x + ControllerState["Z1"]],
> >   Dynamic[y = y + ControllerState["Y2"]],
>
> >   Dynamic[d = Sqrt[Abs[((x - 0)^2) + ((y - 0)^2)]  ] ] ,
> >                 Dynamic[a = (N[Dynamic[d]/1000])],
> >   (* Print[]  *)
>
> >                 "Z1" -> {x, -1000, 1000, .01},
> >                        "Y2" -> {y, -1000, 1000, .01},
>
> >                     ControllerMethod -> "None"]]
>
> >   When I remove the comment parentheses and asterix,
> > it works,,,slowly. If I leave the them, the disk won't change
> > color. How can I implement this better?Correctly?
> > I have a similar problem in 3D Below:
>
> > DynamicModule[{x = 900, y = 900, z = 900, d = 0.00, p = 1.3, q = -2.4,
> >    r = 2, a = 1},
> >  ControllerManipulate[
>
> >   Dynamic[
> >    Graphics3D[{PointSize[Large], Hue[Dynamic[a]],
> >      Sphere[{0, 0, 0}, 200], {Hue[.8], Sphere[{x, y, z}, 50]}},
> >     PlotRange -> 1050, AspectRatio -> Automatic,
> >     BoxRatios -> {1, 1, 1}, Axes -> True, ImageSize -> {600, 600},
> >     ViewPoint -> {p, q, r}]],
>
> >   Dynamic[
> >    d = Sqrt[((Dynamic[x] - 0)^2) + ((Dynamic[y] -
> >           0)^2) + ((Dynamic[z] - 0)^2)]  ],
> >    Dynamic[a = (N[Dynamic[d]/1000])],
> >   Dynamic[z = z + ControllerState["Y1"]],
> >   Dynamic[x = x + ControllerState["Z1"]],
> >   Dynamic[y = y + ControllerState["Y2"]],
> >   Dynamic[p = p + ControllerState["X3"]],
> >   Dynamic[q = q + ControllerState["Y3"]],
>
> >   (*Print[],  *)
>
> >   "Y3" -> {q, -10, 10, .00001},
> >   "X3" -> {p, -10, 10, .00001},
> >   "Y1" -> {z, -1000, 1000, .01},
> >   "Z1" -> {x, -1000, 1000, .01},
> >   "Y2" -> {y, -1000, 1000, .01},
> >   ControllerMethod -> "None", TrackedSymbols -> All]
> >      ]
>
> > Gratefull for any help!
>
> --
> Murray Eisenberg                     mur... at math.umass.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower      phone 413 549-1020 (H)
> University of Massachusetts                413 545-2859 (W)
> 710 North Pleasant Street            fax   413 545-1801
> Amherst, MA 01003-9305

Thanks Murray, Yeah, I know the Print statement is wrong. But Why must
it be there in order
for the color of the disk (or sphere in 3d ) to change color as a
function of the distance??
How can I get the program to work without the Print statement?( comma
aside)
Thanks for your time.

```

• Prev by Date: RE: Using ShowLegend
• Next by Date: Re: Working with factors of triangular numbers.
• Previous by thread: Re: gamepad graphics
• Next by thread: Cube codes just done in Mathematica
{"ft_lang_label":"__label__en","ft_lang_prob":0.70376986,"math_prob":0.7918039,"size":3309,"snap":"2019-35-2019-39","text_gpt3_token_len":1160,"char_repetition_ratio":0.16611195,"word_repetition_ratio":0.11658456,"special_character_ratio":0.4599577,"punctuation_ratio":0.24731183,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98115224,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-09-23T02:11:28Z\",\"WARC-Record-ID\":\"<urn:uuid:97af0b95-ec9c-460a-945e-8589b4974b0d>\",\"Content-Length\":\"45972\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3b500b77-e9c5-4b1d-bf4e-86e315db35bc>\",\"WARC-Concurrent-To\":\"<urn:uuid:03a5c741-1cfb-49f7-87bc-4bae3111619d>\",\"WARC-IP-Address\":\"140.177.205.73\",\"WARC-Target-URI\":\"http://forums.wolfram.com/mathgroup/archive/2007/Aug/msg00245.html\",\"WARC-Payload-Digest\":\"sha1:UFLX7QNQLTO3IYP2TJGQ73XFE4K37VRU\",\"WARC-Block-Digest\":\"sha1:KKS4YQB6KNTZRFTRKCQ2U57ZGJMQYJBO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-39/CC-MAIN-2019-39_segments_1568514575844.94_warc_CC-MAIN-20190923002147-20190923024147-00433.warc.gz\"}"}