[Dev] Randomized Testing with Shapes in Direction Cosines

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Dev] Randomized Testing with Shapes in Direction Cosines

ralford
Hello, 

I wanted to tap the list as a resource and see if anyone had thoughts on this. I am currently implementing a geodesic polygon which is represented on the backend in direction vectors (also called direction cosines). This representation allows for particularly fast computation. However, I also realized recently that the orientation of these vectors in a counterclockwise direction is a powerful assertion that allows other computations to work. 

However, this makes randomized testing particularly challenging. If I were to pick any set of random points as vectors, probability says most would not have some consistent orientation. One thought was to have a set of unit vectors with fixed directions to which I apply random scale factors? Or maybe randomized testing just isn't appropriate here and I should use constants. 

Any thoughts? 

Thanks, 
Rebecca


_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|

Re: [Dev] Randomized Testing with Shapes in Direction Cosines

dsmiley
Hi,

Well I wouldn't get hung up on wether or not you can develop a randomized test or not.  I suggest simply starting with some static tests (small # vertexes, integer coordinates).  The polygon as a whole might be too challenging to test in a randomizes sense but perhaps the internal components could be unit tested with such principles.  For example, I believe you convert lat & lon to directed-cosine, and perhaps you can do the reverse?  If so you can easily test that random points round-trip back to the start, within tolerances.  And maybe some of S2's tests could be ported?

~ David


On Sun, Mar 23, 2014 at 7:38 PM, Rebecca Alford <[hidden email]> wrote:
Hello, 

I wanted to tap the list as a resource and see if anyone had thoughts on this. I am currently implementing a geodesic polygon which is represented on the backend in direction vectors (also called direction cosines). This representation allows for particularly fast computation. However, I also realized recently that the orientation of these vectors in a counterclockwise direction is a powerful assertion that allows other computations to work. 

However, this makes randomized testing particularly challenging. If I were to pick any set of random points as vectors, probability says most would not have some consistent orientation. One thought was to have a set of unit vectors with fixed directions to which I apply random scale factors? Or maybe randomized testing just isn't appropriate here and I should use constants. 

Any thoughts? 

Thanks, 
Rebecca



_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|

Re: [Dev] Randomized Testing with Shapes in Direction Cosines

ralford
HI, 

I definitely agree - don't want to stop too much on the randomization. I think I am more thinking about just a generally robust way to test methods that are completely internal (i.e. CCW methods, intersection methods) whereas the whole shape can definitely be testing in lat/lon. Can definitely use some of S2's tests. 

Rebecca


On Sun, Mar 23, 2014 at 11:42 PM, [hidden email] <[hidden email]> wrote:
Hi,

Well I wouldn't get hung up on wether or not you can develop a randomized test or not.  I suggest simply starting with some static tests (small # vertexes, integer coordinates).  The polygon as a whole might be too challenging to test in a randomizes sense but perhaps the internal components could be unit tested with such principles.  For example, I believe you convert lat & lon to directed-cosine, and perhaps you can do the reverse?  If so you can easily test that random points round-trip back to the start, within tolerances.  And maybe some of S2's tests could be ported?

~ David


On Sun, Mar 23, 2014 at 7:38 PM, Rebecca Alford <[hidden email]> wrote:
Hello, 

I wanted to tap the list as a resource and see if anyone had thoughts on this. I am currently implementing a geodesic polygon which is represented on the backend in direction vectors (also called direction cosines). This representation allows for particularly fast computation. However, I also realized recently that the orientation of these vectors in a counterclockwise direction is a powerful assertion that allows other computations to work. 

However, this makes randomized testing particularly challenging. If I were to pick any set of random points as vectors, probability says most would not have some consistent orientation. One thought was to have a set of unit vectors with fixed directions to which I apply random scale factors? Or maybe randomized testing just isn't appropriate here and I should use constants. 

Any thoughts? 

Thanks, 
Rebecca





--
--
Rebecca Faye Alford
Carnegie Mellon '16
B.S. Chemistry and Software Engineering
Undergraduate Research Assistant - Gray Lab, Johns Hopkins

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com