Difference between revisions of "Talk:GetDistance - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Rasikko
m
imported>Rasikko
m
Line 1: Line 1:
This function uses the Pythagorean Theorem based distance formula. The function most likely has to first convert the x and y positions to coordinates. Then adjust any negative coordinates to match up with their counterparts in the CK(in game they are offset by 1), and using the formula will lead to possibly calling [[Sqrt - Math]], and calling [[Pow - Math]] twice, under the hood, making this a rather expensive function to use repeatedly. Having said that, while not totally necessary, you can code your own GetDistance function --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-05-28T08:55:45 (EDT)
This function uses the Pythagorean Theorem based distance formula. The function most likely has to first convert the x and y positions to coordinates. Then adjust any negative coordinates to match up with their counterparts in the CK(in game they are offset by 1), and using the formula will lead to possibly calling [[Sqrt - Math]], and calling [[Pow - Math]] twice, under the hood, making this a rather expensive function to use repeatedly. Having said that, while not totally necessary, you can code your own GetDistance function --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-05-28T08:55:45 (EDT)
:Alright, with more testing, this function doesn't appear to use the Theorem after all. Perhaps I wont figure this out, I can only get within a few units of the returned value using different math equations, not close enough to my satisfaction. This might dig pretty deep into trigonometry which is out of the scope of my understanding at this time, I aimed to find away to calculate distance without using this function. --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-05-29T01:43:53 (EDT)
:Alright, with more testing, this function doesn't appear to use the Theorem after all. Perhaps I wont figure this out, I can only get within a few units of the returned value using different math equations, not close enough to my satisfaction. This might dig pretty deep into trigonometry which is out of the scope of my understanding at this time, I aim to find a way to calculate distance without using this function. --[[User:Rasikko|Rasikko]] ([[User talk:Rasikko|talk]]) 2018-05-29T01:43:53 (EDT)

Revision as of 00:45, 29 May 2018

This function uses the Pythagorean Theorem based distance formula. The function most likely has to first convert the x and y positions to coordinates. Then adjust any negative coordinates to match up with their counterparts in the CK(in game they are offset by 1), and using the formula will lead to possibly calling Sqrt - Math, and calling Pow - Math twice, under the hood, making this a rather expensive function to use repeatedly. Having said that, while not totally necessary, you can code your own GetDistance function --Rasikko (talk) 2018-05-28T08:55:45 (EDT)

Alright, with more testing, this function doesn't appear to use the Theorem after all. Perhaps I wont figure this out, I can only get within a few units of the returned value using different math equations, not close enough to my satisfaction. This might dig pretty deep into trigonometry which is out of the scope of my understanding at this time, I aim to find a way to calculate distance without using this function. --Rasikko (talk) 2018-05-29T01:43:53 (EDT)