Sign in to follow this  
Followers 0
timsta97

How do I invert a point as if on a coordinate plane

2 posts in this topic

If I have a point (50, 30) How would I get an inverted point in the same quadrant (Quadrant I)?

Let's say the quadrant is (100, 100)

Share this post


Link to post
Share on other sites



So you want to enter (50, 30) and get back (30, 50)? This code will do that, but it has absolutely no error checking.

Local $point = InputBox("Enter a point", "Format: (x, y)" & @CRLF & "Min: 100" & @CRLF & "Max: 100")
MsgBox(64, "The inverted point's coordinates are:", _InvertPoint($point))

Func _InvertPoint($sPoint)
    Local $aPoint = StringSplit(StringRegExpReplace(StringStripWS($sPoint, 8), "\(|\)", ""), ",", 2)
    $sPoint = "(" & $aPoint[1] & ", " & $aPoint[0] & ")"
    Return $sPoint
EndFunc

Thanks, this code is great, If I need to I could try to add some error checking.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0