On Fri, Jan 17, 2014 at 12:56 AM, mshayganfar <notifications@github.com>wrote:

> In core/agent/java/edu/wpi/always/client/GazeRealizer.java:
>
> >      *
> >      * @return between (inclusive) -1 (agent's right) and +1 (agent's left)
> >      */
> > -    public static float translateToAgentTurnHor (Point p) {
> > -       // NB: Make sure to change translateAgentTurn if change this
>
> PS. based on the type of tuning we have, it is kind of over complicated.
>

Yes the conditionals make it a bit complicated, but I am sure you can do
it.  It is only simple arithmetic, after all.   Just sit down with a piece
of paper and work it out the inverse function.

MAKE SURE YOU DO SOME TEST CASES, e.g., with a little main program in
GazeRealizer something like:

        public static void main (String[] args) {
           test(0, 0); test(0,.5); test(.5,0); test(.5,.5); test(.5,1);
test(1,.5) test(1,1);
           test(0, -0.5); ... etc.

        }

        private static void test (float hor, float ver) {
             Point point = translateToAgentTurn(hor, ver);
             System.out.println(point+": "+(hor -
translateAgentTurnHor(point))+" "+(ver - translateAgentTurn(point)));
       }

It is common practice to put test cases in main methods like this.

-CR

> —
> Reply to this email directly or view it on GitHub<https://github.com/always-on/always/pull/196/files#r8953026>
> .
>



-- 
Dr. Charles Rich, Professor, Computer Science Department<http://www.cs.wpi.edu>
Interactive Media and Game Development
Program<http://www.wpi.edu/academics/imgd/>
Robotics Engineering Program <http://www.wpi.edu/academics/robotics/>
Worcester Polytechnic Institute, Fuller Laboratories B25b
100 Institute Road, Worcester, MA 01609-2280

Email: rich@wpi.edu   Phone: 508-831-5945   Fax: 508-831-5776
Home: http://www.cs.wpi.edu/~rich