Figuring an angle?
Michael Mantkowski
michaelj at clientrax.com
Sun Oct 10 18:55:26 UTC 2021
Hi Daz,
Yes, you can move objects and read the location.
Here is an example.
HotPict is a shape object I use to place a crop square over a picture field. As you can see you can read the location of the object as you move it around. Once you let the mouse up then you can read the new location. Figuring out the angle is another story. But this will get you to the point of knowing where your object is.
Calculate lvTopStart as lvHotPictRef.$top
Calculate lvLeftStart as lvHotPictRef.$left
Calculate lvTopMove as mouseover(kMVert)
Calculate lvLeftMove as mouseover(kMHorz)
While mousedn()
Calculate lvTmpTop as lvTopStart+mouseover(kMVert)-lvTopMove
Calculate lvTmpLeft as lvLeftStart+mouseover(kMHorz)-lvLeftMove
If lvTop<>lvTmpTop|lvLeft<>lvTmpLeft
Calculate lvTop as lvTmpTop
Calculate lvLeft as lvTmpLeft
Calculate lvHotPictRef.$top as lvTopStart+(mouseover(kMVert)-lvTopMove)
Calculate lvHotPictRef.$left as lvLeftStart+(mouseover(kMHorz)-lvLeftMove)
Do lvPictRef.$redraw(kFalse,kTrue)
Do lvHotPictRef.$redraw(kTrue,kTrue)
End If
End While
*********************************************************************
Michael Mantkowski
ClienTrax Software
1-614-875-2245
*********************************************************************
-----Original Message-----
From: omnisdev-en On Behalf Of Das Goravani
Sent: Sunday, October 10, 2021 2:33 PM
To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Subject: Figuring an angle?
Dear $all,
Can anyone of you figure this out?
I want to know the Angle, in degrees 0 to 360, between two $objs on a thick window.
Picture this, the user drags an object, and when they let go the app figures out the angle between that dragged object and the center of a circle they were dragging over..
Now that I think about it, I think I’m out of luck because although you can drag fields by setting their drag property I don’t think there’s an event when they let go of the field.. and I doubt it’s location properties are set to where it was dragged to.. would have to have fields around the edge they could drag ONTO then we could know the location of what they dropped on.
This is for astrology. I work in circles representing space around the earth. I would love to have drag and get angle so that I could then adjust things onscreen to how they dragged.. they could rotate things..
I think I’m out of luck.
If you have any ideas let me know.
As an alternative, it just occurred to me, that I think there are coordinates available for the location of the mouse pointer.. perhaps they could click a planet they want to drag, and instead of dragging they click the location they want it to go to.. I am given those coordinates by some mouse pointer thing Omnis has, and I work with that.. so given this, it seems I CAN know the location they want to “go to” and I know the center.. so the original question stands, can I know the ANGLE of those two by some trick of math? Does any of you know how to get the angle from two objects or locations onscreen.. in pixels.. I imagine the tan() function might be involved.
I do a lot of work like this kind of thing from another angle of approach.. like typical is I KNOW the angle, and I need to derive the pixels.. I have that wired.. got it from astronomy to computer books.. got a lot from those.. I rotate objects around the screen well.. but I’ve never approached this “selection of an angle” and THEN do something..
It just occurred to me that I could contantly move a line based on location of mouse pointer.. keep one end of the line on the center, move the other end to match the mouse tip, then I’d have an angled line when they let go.. don’t know if that would help me.. but it’s ends are what I want to derive the angle from.
Any of you mathematicians?
Das Goravani
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list