#robotics Logs

Nov 03 2018

#robotics Calendar

12:03 AM rue_mohr: ok, aside from a horrid list of globals, I think this is good to take on the dxf code
12:07 AM rue_mohr: there are 10 globals dude;
12:07 AM rue_mohr: yea, like I said, a horrid list
12:13 AM rue_mohr: ok, I have a list I can populate with stuff and the user can click on
12:13 AM rue_mohr: I got a drawing area that I can draw stuff in
12:13 AM rue_mohr: and I got 24 bit colour that I can draw with
12:13 AM rue_mohr: I can get click/drag and scroll events on the drawing area
12:14 AM rue_mohr: I think its time to make this program radically more complex
12:14 AM rue_mohr: insert the libraries!
12:18 AM rue_mohr: ok, the first thing I need is to pull in my arbitrary shape and 2d libraries
12:23 AM rue_mohr: dear god my 2d library grew ... alot
12:25 AM rue_mohr: hmm a bit short on general drawing stuff
12:25 AM rue_mohr: but this doesn't handle lists of objects
12:25 AM rue_mohr: hmm
12:26 AM rue_mohr: bend my library in a new way
12:26 AM rue_mohr: if I scale all the control points of a data set, and then all the radii, I suppose its scaled
12:26 AM rue_mohr: never thought to scale a circle
12:27 AM rue_mohr: line_t * scaleLine (line_t *l, point2d_t by) ;
12:27 AM rue_mohr: so I need an arc scale
12:28 AM rue_mohr: I suppose I could add some convienience stuff for handling rotating/translating/scaling circicles
12:39 AM rue_mohr: wow, betrayal, the only thing that uses my arbitrary shape library is the dxf library, and it renames all the methods and types
12:40 AM * rue_mohr thinks
12:50 AM rue_mohr: ok, there is 7 more functions I need to write.
12:50 AM rue_mohr: arc_t * initArc (arc_t *a) ;
12:50 AM rue_mohr: arc_t * setArc (arc_t *a, double x1, double y1, double r, double start, double end) ;
12:50 AM rue_mohr: #define setCircle(A,B,C,D) setArc(A, B, C, D, 0, 360)
12:50 AM rue_mohr: arc_t * setArcPR (arc_t *a, point2d_t c, double r, double start, double end);
12:50 AM rue_mohr: #define setCirclePR(A,B,C) setArcPR(A, B, C, 0, 360)
12:50 AM rue_mohr: arc_t * setArcArc (arc_t *a, arc_t to);
12:50 AM rue_mohr: arc_t * transArc (arc_t *a, point2d_t by);
12:50 AM rue_mohr: arc_t * rotArcAround (arc_t *a, point2d_t around, double by);
12:50 AM rue_mohr: arc_t * scaleArc (arc_t *a, point2d_t by); // position and size
12:50 AM rue_mohr: char * arc2s (char *s, int bl, arc_t * this);
12:58 AM rue_mohr: hehe, i wonder if I should make an arc2circle fn
01:08 AM rue_mohr: 8-| there is a core error in my definition of an arc
01:08 AM rue_mohr: only 1 radius
01:09 AM rue_mohr: oh geez, so
01:10 AM rue_mohr: nonally would I need 2 radii, I would need to specify a rotation that the radii lie on
01:11 AM rue_mohr: typedef struct arc_s {
01:11 AM rue_mohr: point2d_t c;
01:11 AM rue_mohr: double r;
01:11 AM rue_mohr: double start;
01:11 AM rue_mohr: double end;
01:11 AM rue_mohr: } arc_t;
01:24 AM mrdata__: only 1 radius??!?
01:24 AM mrdata__: impossibre!
01:29 AM rue_mohr: https://www.autodesk.com/techpubs/autocad/acad2000/dxf/ellipse_dxf_06.htm
01:29 AM rue_mohr: this will be my foe
01:29 AM rue_mohr: its a sudden bump in my development of a CAM program
01:29 AM rue_mohr: as my 2d library doesn't deal with that
01:31 AM rue_mohr: so, there is a centre and endpoints of major axii
01:31 AM rue_mohr: which deals with rotation
01:31 AM rue_mohr: hmmmmmmmmmmmm
01:32 AM rue_mohr: whats most evil is that what I have now is all a subset of a rotated ellipse
01:32 AM rue_mohr: so I ahve to redo my code
01:33 AM rue_mohr: AND, X doesn't have fuctions to draw that
01:33 AM rue_mohr: ooof
01:36 AM rue_mohr: one of the other problems I had comming up is that X only has a resolution of 1/64 of a degree on arcs
01:37 AM rue_mohr: so, if you have an arc with a huge radius, and your zooming into and end intersection, there will be a gap
02:22 AM mrdata__: but ellipse functions are well understood,
02:22 AM mrdata__: the math is pretty comprehensible
02:23 AM mrdata__: and affine transformations are understood too
02:23 AM mrdata__: so yes it's a chore but worth doing to upgrade your routines
02:26 AM rue_mohr: ok so
02:26 AM rue_mohr: what is the general form for a rotated ellipse?
02:31 AM mrdata__: let's derive it
02:31 AM mrdata__: first, the general form of an ellipse
02:31 AM mrdata__: isnt it, x^2/a^2 + y^2/b^2 = 1 ?
02:32 AM mrdata__: where a is semi-major axis, b is semi-minor axis
02:32 AM rue_mohr: https://i.ytimg.com/vi/auD46ZWZxQo/maxresdefault.jpg
02:32 AM * rue_mohr shrugs
02:32 AM mrdata__: then parametrically apply rotation transformation
02:32 AM rue_mohr: no
02:33 AM mrdata__: no, what?
02:33 AM rue_mohr: thats like ... apples and ornages in one op, your gonna go general form, you need all the generals in on it
02:34 AM mrdata__: sure, throw in translations if you like, then
02:35 AM mrdata__: but you dont have to make it too complicated too early
02:35 AM rue_mohr: https://www.quora.com/What-is-the-standard-form-of-an-ellipse
02:37 AM mrdata__: if youre going to use it for practical purposes, you want to express your knowledge of the amount rotated so that you can keep the right shape and size
02:37 AM rue_mohr: general form would be for intersections
02:38 AM mrdata__: so, irrespective of translation and rotation, the ellipse has a centre, and semi-major and semi-minor axes
02:40 AM mrdata__: i note that the page you linked references my equation as well
02:41 AM rue_mohr: typedef struct lineGF_s {
02:41 AM rue_mohr: double A, B, C; // A*x + B*y = C
02:41 AM rue_mohr: } lineGF_t;
02:41 AM rue_mohr: typedef struct ellipArcGF_s {
02:41 AM rue_mohr: double A, B, C, D, E, F; // A*x^2+B*xy+C*y^2+D*x+E*y = F
02:41 AM rue_mohr: } ellipArcGF_t;
02:41 AM rue_mohr: ^^ that mismatch sucks
02:41 AM rue_mohr: bah its not an arc then
02:42 AM mrdata__: so, x^2/a^2 + y^2/b^2 = 1 is called the standard form
02:42 AM rue_mohr: that aside, arg
02:42 AM mrdata__: yes i agree it is a chore
02:42 AM rue_mohr: and the xy factor deal with the rotation
02:43 AM mrdata__: except that isnt rotation by degrees or radians; it's more a slope thing, iirc
02:43 AM rue_mohr: as long as it stays under infinity I'm ok with that
02:46 AM mrdata__: but you might find, that peculiar complication is what atan2() is meant to deal with
02:49 AM rue_mohr: hmm kitchen was on fire, cooking robot didn't take it as a problem of any kind...
02:49 AM * rue_mohr thinks
02:59 AM rue_mohr: I think I can cheat
02:59 AM rue_mohr: if I don't handle the ellipses right now
03:00 AM rue_mohr: I should be able to write a comatability layer for the current functions that expresses everything in ellipses
03:03 AM Jak_o_Shadows: matplotlib didn't like doing the transforms to plot an arc on a polar axis
03:03 AM Jak_o_Shadows: In the end I said "stuff it", and did it by hand
03:04 AM Jak_o_Shadows: cause it handles regular xy points fine
03:08 AM rue_mohr: this library HAS come a long way for something that was just meant to scale/translate/rotate points
03:10 AM rue_mohr: in a dxf, an ellipse is expressed as a center point, the endpoint of the major axis, and a ratio to the minor axis
03:12 AM rue_mohr: I cant imagine what they have under the hood
03:13 AM rue_mohr: cause the mere thought of using those terms to scale an ellipse thats rotated by 45 degrees only on the Y axis hurts my brain
03:14 AM rue_mohr: I presume you break the major and minor axis' into thier components and scale them individually
04:17 AM flav0r: good times
04:17 AM flav0r: the bug i was working on is now solved
04:48 AM rue_mohr: ok, I can draw an arbitrary shape
04:48 AM rue_mohr: void drawEntity ( arbShape_t E ) {
04:48 AM rue_mohr: switch(E.type) {
04:48 AM rue_mohr: case LINE: ...
04:49 AM rue_mohr: SO, that just leaves loading and showing a dxf
04:49 AM rue_mohr: or I do pan and zoom now
04:52 AM rue_mohr: it IS 3am tho
04:53 AM rue_mohr: I suppose the offset and zoom should be done as I'm rendering,
04:54 AM rue_mohr: its prolly not good to have the view affect the actual file data
02:52 PM patr0clus is now known as s3nd1v0g1us
04:44 PM rue_mohr: ok
04:45 PM rue_mohr: I'm able to read a list of objects and render them on the screen