{"action":"created","issue":{"url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/13","repository_url":"https://api.github.com/repos/MOARdV/AvionicsSystems","labels_url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/13/comments","events_url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/13/events","html_url":"https://github.com/MOARdV/AvionicsSystems/issues/13","id":173005458,"number":13,"title":"Mapped Variables","user":{"login":"DeputyLOL","id":12616126,"avatar_url":"https://avatars.githubusercontent.com/u/12616126?v=3","gravatar_id":"","url":"https://api.github.com/users/DeputyLOL","html_url":"https://github.com/DeputyLOL","followers_url":"https://api.github.com/users/DeputyLOL/followers","following_url":"https://api.github.com/users/DeputyLOL/following{/other_user}","gists_url":"https://api.github.com/users/DeputyLOL/gists{/gist_id}","starred_url":"https://api.github.com/users/DeputyLOL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DeputyLOL/subscriptions","organizations_url":"https://api.github.com/users/DeputyLOL/orgs","repos_url":"https://api.github.com/users/DeputyLOL/repos","events_url":"https://api.github.com/users/DeputyLOL/events{/privacy}","received_events_url":"https://api.github.com/users/DeputyLOL/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MOARdV/AvionicsSystems/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"MOARdV","id":6089493,"avatar_url":"https://avatars.githubusercontent.com/u/6089493?v=3","gravatar_id":"","url":"https://api.github.com/users/MOARdV","html_url":"https://github.com/MOARdV","followers_url":"https://api.github.com/users/MOARdV/followers","following_url":"https://api.github.com/users/MOARdV/following{/other_user}","gists_url":"https://api.github.com/users/MOARdV/gists{/gist_id}","starred_url":"https://api.github.com/users/MOARdV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MOARdV/subscriptions","organizations_url":"https://api.github.com/users/MOARdV/orgs","repos_url":"https://api.github.com/users/MOARdV/repos","events_url":"https://api.github.com/users/MOARdV/events{/privacy}","received_events_url":"https://api.github.com/users/MOARdV/received_events","type":"User","site_admin":false},"assignees":[{"login":"MOARdV","id":6089493,"avatar_url":"https://avatars.githubusercontent.com/u/6089493?v=3","gravatar_id":"","url":"https://api.github.com/users/MOARdV","html_url":"https://github.com/MOARdV","followers_url":"https://api.github.com/users/MOARdV/followers","following_url":"https://api.github.com/users/MOARdV/following{/other_user}","gists_url":"https://api.github.com/users/MOARdV/gists{/gist_id}","starred_url":"https://api.github.com/users/MOARdV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MOARdV/subscriptions","organizations_url":"https://api.github.com/users/MOARdV/orgs","repos_url":"https://api.github.com/users/MOARdV/repos","events_url":"https://api.github.com/users/MOARdV/events{/privacy}","received_events_url":"https://api.github.com/users/MOARdV/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-08-24T16:56:33Z","updated_at":"2016-08-24T18:06:33Z","closed_at":null,"body":"On the RPM issue you said that I could use this as a remap variable:\r\n\r\nfunction Remap(value, bound1, bound2, map1, map2)\r\n  value = math.max(bound1, math.min(bound2, value))\r\n  local iLerp = (value - bound1) / (bound2-bound1)\r\n  return map1 + iLerp * (map2 - map1)\r\nend\r\n\r\nI suspect that I don't know what I'm doing and I'm not using it right. My script is like this:\r\n\r\nfunction Remap(value, bound1, bound2, map1, map2)\r\n  value = math.max(bound1, math.min(bound2, value))\r\n  local iLerp = (value - bound1) / (bound2-bound1)\r\n  return map1 + iLerp * (map2 - map1)\r\nend\r\n\r\nfunction ACSkyPointerDisplace()\r\n\tif 65 < ACRollAngle() < 90 then\r\n\t\t-- Are we subjected to high gravity?  We might have some flicker\r\n\t\t-- Original design used RANDOM between 0.2 and 0.4, but since RANDOM is\r\n\t\t-- a uniform distribution, RANDOM > 0.8 has the same effect.\r\n\t\t\treturn Remap(ACRollAngle(),65,90,0,1)\r\n\tif 90 < ACRollAngle() < 115 then\r\n\t\t\treturn Remap(ACRollAngle(),90,65,1,0)\r\n\telse\r\n\t\t\treturn 0\r\n\tend\r\nend\r\n\r\nWhat am I doing wrong?"},"comment":{"url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/comments/242156939","html_url":"https://github.com/MOARdV/AvionicsSystems/issues/13#issuecomment-242156939","issue_url":"https://api.github.com/repos/MOARdV/AvionicsSystems/issues/13","id":242156939,"user":{"login":"MOARdV","id":6089493,"avatar_url":"https://avatars.githubusercontent.com/u/6089493?v=3","gravatar_id":"","url":"https://api.github.com/users/MOARdV","html_url":"https://github.com/MOARdV","followers_url":"https://api.github.com/users/MOARdV/followers","following_url":"https://api.github.com/users/MOARdV/following{/other_user}","gists_url":"https://api.github.com/users/MOARdV/gists{/gist_id}","starred_url":"https://api.github.com/users/MOARdV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MOARdV/subscriptions","organizations_url":"https://api.github.com/users/MOARdV/orgs","repos_url":"https://api.github.com/users/MOARdV/repos","events_url":"https://api.github.com/users/MOARdV/events{/privacy}","received_events_url":"https://api.github.com/users/MOARdV/received_events","type":"User","site_admin":false},"created_at":"2016-08-24T18:06:33Z","updated_at":"2016-08-24T18:06:33Z","body":"`Remap(ACRollAngle(),65,90,0,1)` says \"Take ACRollAngle, limit it to the range 65 to 90, and then convert that range from 0 to 1\"  So, for angles <= 65, you'll get 0.  For angles >=90, you'll get 1.  Everything else will be linearly interpolated between those value.\r\n\r\nIf you're only interested in getting values between 0 and 1, you can simplify the function to something like \r\n\r\n```\r\nfunction InverseLerp(value, bound1, bound2)\r\n value = math.max(bound1, math.min(bound2, value))\r\n return (value - bound1) / (bound2-bound1)\r\nend\r\n```\r\n\r\n"}}
{"actor":{"display_login":"MOARdV"}}