Page 1 of 1

Distance

Posted: Friday 15 August, 2014 - 12:05
by Hesam Adrang
Hi Dears
How can we import the distance between two atoms in the ED?

Re: Distance

Posted: Thursday 28 August, 2014 - 11:01
by Nienke Valkhoff
Hello Hesam Adrang

The easiest 4DScript word to use is AtomDistance(e1,e2) where e1 and e2 are reference to the atoms between which you need to know the distance. The unit of measurement for distance is meters.

You can also calculate the distance using words for querying the location of an atom: xLoc(e1), yLoc(e1), zLoc(e1) where e1 is a reference to the atom of which you need to know the location. Note that the location will be relative to the Container. For atoms such as a Source, Queue and Server the container is usually the Model itself.

The (x,y)- location of an atom is the location of the top left corner of the atom. Use xSize and ySize in combination with xloc and yloc to get the other coordinates. Note that AtomDistance will also return the distance between the topleft corners of teh atom assuming they are on the same z-location.

In the Help of Enterprise Dynamics you can find more information for words in the category Atom Position: 4DScript Reference Guide > 4DScript Categories > 4DScript Category Atom Position. All 4DScript words in this category deal with the location, size and speed of atoms.The 4DScript word AtomDistance(e1,e2) can be found in in the Help in: 4DScript Reference Guide > 4DScript Categories > Category Network > AtomDistance

Regards,

Nienke

distance between atoms in different containers

Posted: Wednesday 03 September, 2014 - 17:10
by Chiara
Hello,

I have a question about distance between atoms.
Functions like xloc and xAbsLoc give the position relative to the container of the selected atom, but there's a function able to return the position between atoms that are not in the same container?
I tried to write my own function, a sort of roto-translation function, but it doesn't work properly. I think that the trouble is with the large number of containers in which my atom are (and their differrent rotationas). The new function AbsRotationAs is helpfull but doesn't fix my errors.

What can I do?

Thanks

Re: Distance

Posted: Wednesday 03 September, 2014 - 17:26
by Chiara
Sorry,

I didn't specify: I need the distance decomposed in xdistance and ydistance.
Can I calculate the distance by using "atomdistance" and then "sin"/"cos" functions in order to obtain the x/y component?

Thanks

Re: Distance

Posted: Tuesday 28 October, 2014 - 16:03
by HarryBunnik
Ha Chiara,

Perhaps I'm not understanding your question, but using xAbsLoc the location is determined in relation to the second parameter ( which must be an atom in which the first parameter/atom is located). When the second parameter is a reference to the model and you do so for both the atoms you're interested in, it's only a matter of subtracting the xAbsLoc(atom_1, model) and the xAbsLoc(atom_1, model) and to repeat that for the yAbsLoc for both atoms I would think.

I hope this helps you a bit further,

Cheers,

Harry

Re: Distance

Posted: Tuesday 10 February, 2015 - 18:26
by Chiara
Hi Harry,

the trouble is that I don't really need the distance as final objective, I thougth I could use it to obtain the position in coordinates of an atom expressed in the cartesian system coordinates of the other.

For example:
Immagine.jpg
Immagine.jpg (67.25 KiB) Viewed 8806 times
I would know the coordinates of the black atom in relation to the sky-blue atom (that is, -6,-4) even if they aren't in the same container.
I wold find a procedure, a formula to do that, because I don't know the position of the balck atom (maybe it could be over the other one or not, I don't know).

Thank you so much,

Chiara

Re: Distance

Posted: Thursday 12 March, 2015 - 11:46
by Chiara
Anybody?!

Re: Distance

Posted: Friday 13 March, 2015 - 11:59
by HarryBunnik
Ha Chiara,

Sorry for my late response. I had missed your earlier post.

I'm afraid that I'm again lost in what you try to achieve. You want to know the position of the Black atom. Do you have a reference to that atom (first(c), next(c), last(c), i, rank(#, model) or something else)? If you do, you can get the coordinates as I pointed on earlier (left upper corner of the atom is its xLoc, yLoc and zLoc). When you use xLoc, you get it for the local Cartesian system. And with xAbsLoc you get it related to the model.
If you have from both atoms the coordinates related to the model, I would think you can calculate it back to system of the atom you're interested in?

Cheers,

Harry