MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to connect one object to the other?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88927] Re: How to connect one object to the other?
  • From: Syd Geraghty <sydgeraghty at mac.com>
  • Date: Wed, 21 May 2008 14:52:17 -0400 (EDT)
  • References: <200805201053.GAA05101@smc.vnet.net>

Gohar,

Below are two solutions with different characteristics:-

First,

plotObject[G_] :=
  Locator[{RandomReal[30], RandomReal[30]}, Graphics[G], ImageSize ->  
20]


Framed@Graphics[
   Table[{Arrow[{{RandomReal[30], RandomReal[30]}, {RandomReal[30],
        RandomReal[30]}}],
     plotObject[{RGBColor[RandomReal[1], RandomReal[1], RandomReal[1],  
0.5],
       Disk[{5, 5}, 5]}]}, {i, 10}], PlotRange -> 50]

gives black arrows which can be double clicked to move, resize &  
redirect each of them but are not Locators.

Second,

plotObject[G_] :=
  Locator[{RandomReal[30], RandomReal[30]}, Graphics[G], ImageSize ->  
40]

Framed@Graphics[
   Table[{plotObject[{RGBColor[RandomReal[1], RandomReal[1],  
RandomReal[1],
        0.5], Arrowheads[Large],
       Arrow[{{RandomReal[30], RandomReal[30]}, {RandomReal[30],
          RandomReal[30]}}]}],
     plotObject[{RGBColor[RandomReal[1], RandomReal[1], RandomReal[1],  
0.9],
       Disk[{5, 5}, 5]}]}, {i, 10}], PlotRange -> 50]

gives random coloured arrows which are locators which can be dragged  
but which cannot be resized or redirected.

HTH,

Cheers ... Syd

Syd Geraghty B.Sc, M.Sc.

sydgeraghty at mac.com

My System

Mathematica 6.0.2.1 for Mac OS X x86 (64 - bit) (March 13, 2008)
MacOS X V 10.5.2
MacBook Pro 2.33 Ghz Intel Core 2 Duo  2GB RAM






On May 20, 2008, at 3:53 AM, Gohar Sultan wrote:

> i am using Mathematica 6 on Window XP
>
> this code makes disk drag able disk objects, i want to connect them  
> with
> arrow, how con i achieve this, any ideas?
>
> plotObject[G_] := Locator[{RandomReal[30], RandomReal[30]},
>  Graphics[G], ImageSize -> 20]
>
> p = {
>  RGBColor[RandomReal[1], RandomReal[1], RandomReal[1], 0.5],
>  Disk[{5, 5}, 5]
>  }
>
> Framed@Graphics[
>  Table[plotObject[{RGBColor[RandomReal[1], RandomReal[1],
>      RandomReal[1], 0.5], Disk[{5, 5}, 5]}], {i, 10}],
>  PlotRange -> 50]
>
>
>
>
> Thanks in advance,
> Gohar Sultan
>
>



  • Prev by Date: Re: Problems with ListPlot
  • Next by Date: Re: DumpSave of packages - now it works
  • Previous by thread: How to connect one object to the other?
  • Next by thread: Re: Re: How to connect one object to the other?