Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help to translate this system of cords[mathematic] problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Fri May 05, 2017 3:01 pm    Post subject: Help to translate this system of cords[mathematic] problem Reply with quote

I want you to make equation to calculate (x,y) from Longitudinal and Transverse lines .


(x,y) → the red numbers
blue numbers → Longitudinal cords
light blue →Transverse cords
the center cords (x51,y51) (1648,3072)



X and y full.jpg
 Description:
 Filesize:  197.73 KB
 Viewed:  5781 Time(s)

X and y full.jpg


Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri May 05, 2017 8:55 pm    Post subject: This post has 1 review(s) Reply with quote

Code:
function firstTransform(x,y)
  -- reflect at y=3072
  -- -(y-3072)+3072=-y+3072+3072=6144-y
  y=6144-y

  --scale x by 2
  x=2*x

  --rot 45° ccw at {2*1648 , 3072}
  local a,b=(2*1648),3072
  local t=1/(2^0.5)
  x,y = x-a, y-b
  return t*x - t*y + a, t*x + t*y + b
end

ScaleFirstTransform_scale=nil
function ScaleFirstTransform(xx,yy)

  if ScaleFirstTransform_scale==nil then
    -- point1 (1040,3072) -> (32,32)
    local x1,y1=firstTransform(1040,3072)

    -- point3 (2256,3072) -> (70,70)
    local x3,y3=firstTransform(2256,3072)

    --scale for x:
    local ax = 38/(x3-x1)  -- 70-32 = 38
    local bx = 32-x1*ax

    --scale for y:
    local ay = 38/(y3-y1)  -- 70-32 = 38
    local by = 32-y1*ay

    ScaleFirstTransform_scale = {{ax,bx},{ay,by}}
  end

  local t=ScaleFirstTransform_scale

  local x,y = firstTransform(xx,yy)
  return x*t[1][1]+t[1][2],y*t[2][1]+t[2][2]
end

function TwistedfateTransform(x,y)
  return ScaleFirstTransform(x,y)
end

print('tests:')
print('(1040,3072) -> (32,32), we get:',TwistedfateTransform(1040,3072))
print('(1648,1856) -> (32,70), we get:',TwistedfateTransform(1648,1856))
print('(2256,3072) -> (70,70), we get:',TwistedfateTransform(2256,3072))
print('(1648,4288) -> (70,32), we get:',TwistedfateTransform(1648,4288))

print('(1344,2464) -> (32,51), we get:',TwistedfateTransform(1344,2464))
print('(1344,3680) -> (51,32), we get:',TwistedfateTransform(1344,3680))
print('(1952,2464) -> (51,70), we get:',TwistedfateTransform(1952,2464))
print('(1952,3680) -> (70,51), we get:',TwistedfateTransform(1952,3680))

print('(1648,3072) -> (51,51), we get:',TwistedfateTransform(1648,3072))

_________________
Back to top
View user's profile Send private message MSN Messenger
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Sat May 06, 2017 2:15 am    Post subject: Reply with quote

Wink Wink
Thank you ! Thank you ! Thank you ! Thank you ! Thank you !
its read perfect !!
is there any reference you used to solve that ?
I didn't expect any one to solve it <3 .
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat May 06, 2017 5:29 pm    Post subject: Reply with quote

Some time ago I made similar 2D transformations.
_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites