|
From: | Nathan Aherne |
Subject: | Re: [Paparazzi-devel] Issues building |
Date: | Sun, 30 May 2010 11:36:41 +1000 |
Hi Jeremy, Thanks for pointing me in the right direction! I have tested this out and your idea works. I was trying to find a more elegant solution and discovered the below: You do not need to put the Bungee Takeoff values in your airframe file to use PolygonSurvey. All you need to do is delete any reference to the other functions and leave the below code in the OSAMNav.c file (I left it at the bottom of the file after all the PolySurvey code): **************************************************************************** /* Translates point so (transX, transY) are (0,0) then rotates the point around z by Zrot */ void TranslateAndRotateFromWorld(struct Point2D *p, float Zrot, float transX, float transY) { float temp; p->x = p->x - transX; p->y = p->y - transY; temp = p->x; p->x = p->x*cos(Zrot)+p->y*sin(Zrot); p->y = -temp*sin(Zrot)+p->y*cos(Zrot); } /* Rotates point round z by -Zrot then translates so (0,0) becomes (transX,transY) */ void RotateAndTranslateToWorld(struct Point2D *p, float Zrot, float transX, float transY) { float temp = p->x; p->x = p->x*cos(Zrot)-p->y*sin(Zrot); p->y = temp*sin(Zrot)+p->y*cos(Zrot); p->x = p->x + transX; p->y = p->y + transY; } void FindInterceptOfTwoLines(float *x, float *y, struct Line L1, struct Line L2) { *x = ((L2.b-L1.b)/(L1.m-L2.m)); *y = L1.m*(*x)+L1.b; } float EvaluateLineForY(float x, struct Line L) { return (L.m*x)+L.b; } float EvaluateLineForX(float y, struct Line L) { return ((y-L.b)/L.m); } float DistanceEquation(struct Point2D p1,struct Point2D p2) { return sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)); } ******************************************************************************************************** Kindest regards, Nathan Aherne Reddog Technology Web: www.reddog.com.au Email: address@hidden Mob: 0402 555 080 On 30/05/2010, at 10:27 AM, Jeremy Reinertsen wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |