MAMBO logo MAMBO & the MAMBO Toolbox MAMBO logo

DefineObjects — Association of MAMBO objects with defined observers [mathematica]

DefineObjects[A,Type,options]

DefineObjects[{A1,Type1,options1}, ..., {An,Typen,optionsn}]

A,A1, ..., An: names of defined observers

Type,Type1, ...,Typen: types of Mambo objects

options,options1, ...,optionsn: optional arguments specifying object properties

The function DefineObjects associates a MAMBO object (sphere, cylinder, or block) with an already defined observer. Any number of objects may be associated with a given observer.

The function DefineObjects results in permanent changes to the global variable GlobalObjectDefinitions.

The Type argument takes one of the three values "Sphere", "Cylinder", or "Block".

The optional arguments passed to DefineObjects allow the user to specify internal geometric properties of the Mambo objects, such as color and dimension, and the orientation and position of the object relative to the parent observer:
"point"->Point
where Point is the label of a point that is related to the reference point of the parent observer or a position vector describing the position of the reference point of the object relative to the parent observer. In the absence of a point specification, the reference point of the object is assumed to coincide with that of the parent observer.
"orient"->Triad
where Triad is the label of a triad that is related to the reference triad of the parent observer or a rotation matrix describing the orientation of the reference triad of the object relative to the parent observer. In the absence of an orient specification, the reference triad of the object is assumed to coincide with that of the parent observer.
"radius"->R,"length"->L,"xlength"->XL,"ylength"->YL,"zlength'->ZL
where R, L, XL, YL, and ZL are algebraic expressions. Of these, the radius specification only applies to spheres and cylinders, the length specification only applies to cylinders, and the xlength, ylength, and zlength specifications only apply to blocks. In the absence of any of these specifications, the corresponding dimensions (when appropriate) are assumed to equal 1.
"color"->"Color"
where Color is the label white, black, red, green, blue, yellow, magenta, or cyan, or is a string of the form "{r,g,b}", where r, g, and b are algebraic expressions. In the absence of a color specification, the object color is assumed to be white.

Restart;
DeclareObservers[A,B];
DeclarePoints[A,B,C];
DeclareTriads[a,b,c];
DefineObservers[{A,A,a},{B,B,b}];
DefinePoints[{A,B,a,0,1,2},{B,C,c,r-s,0,1}];
DefineTriads[{a,b,theta,1},{a,c,{s-Pi/2,1},{Pi/2,2}}];
DefineNeighbors[A,B];
DefineObjects[
   {A,"Sphere","radius"->1,"orient"->MakeRotations[theta,1],"color"->"red"},
   {B,"Cylinder","point"->B,"orient"->c,"length"->2*p1},
   {A,"Block","xlength"->v,"ylength"->2*v,"zlength"->.5*v,"point"->C}];
GeometryOutput["main"->A]

MODULE A {
   Sphere {
      Orient {1.,0.,0.,0.,cos(theta),-sin(theta),0.,sin(theta),cos(theta)}
      Radius 1.
      Color {1.,0.,0.}
   }
   Block {
      Point {1.,1.-(r-s)*cos(s),2.-(r-s)*sin(s)}
      Xlength v
      Ylength 2.*v
      Zlength 0.5*v
   }
   BODY B {
      Point {0.,1.,2.}
      Orient {1.,0.,0.,0.,cos(theta),-sin(theta),0.,sin(theta),cos(theta)}
      Cylinder {
         Point {0,0,0}
         Orient {0.,0.,1.,-(cos(s)*cos(theta))-sin(s)*sin(theta),cos(theta)*sin(s)-cos(s)*sin(theta),0.,-(cos(theta)*sin(s))+cos(s)*sin(theta),-(cos(s)*cos(theta))-sin(s)*sin(theta),0.}
         Length 2.*p1
      }
   }
}


Toolbox functions