summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 803ae3f)
raw | patch | inline | side by side (parent: 803ae3f)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 5 Jun 2005 22:23:32 +0000 (22:23 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 5 Jun 2005 22:23:32 +0000 (22:23 +0000) |
-- Simon Melhuish <simon mailing from melhuish.info>
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@610 a5681a0c-68f1-0310-ab6d-d61299d08faa
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@610 a5681a0c-68f1-0310-ab6d-d61299d08faa
program/doc/rrdgraph_rpn.pod | patch | blob | history | |
program/src/rrd_rpncalc.c | patch | blob | history | |
program/src/rrd_rpncalc.h | patch | blob | history |
index 4585850bc871abb92cb252823e49e0a0a9e872d0..74ac4ad40751ad898c783bd0185034c7673a0507 100644 (file)
Arctangent (output in radians).
+B<ATAN2>
+
+Arctangent of y,x components (output in radians).
+This pops one element from the stack, the x (cosine) component, and then
+a second, which is the y (sine) component.
+It then pushes the arctangent of their ratio, resolving the ambiguity between
+quadrants.
+
+Example: C<CDEF:angle=Y,X,ATAN2,RAD2DEG> will convert C<X,Y>
+components into an angle in degrees.
+
B<FLOOR, CEIL>
Round down or up to the nearest integer.
-Z<>
+B<DEG2RAD, RAD2DEG>
+
+Convert angle in degrees to radians, or radians to degrees.
=item Set Operations
index 1fd30aa7faca44a6d02448e35464a6227cfc23f2..688becc43a980e403f3d8c92a77c3e45257a3c5c 100644 (file)
add_op(OP_NOW,NOW)
add_op(OP_LTIME,LTIME)
add_op(OP_TIME,TIME)
+ add_op(OP_ATAN2,ATAN2)
add_op(OP_ATAN,ATAN)
add_op(OP_SQRT,SQRT)
add_op(OP_SORT,SORT)
add_op(OP_REV,REV)
add_op(OP_TREND,TREND)
+ add_op(OP_RAD2DEG,RAD2DEG)
+ add_op(OP_DEG2RAD,DEG2RAD)
#undef add_op
}
(*str)[offset] = '\0';
match_op(OP_ISINF,ISINF)
match_op(OP_NOW,NOW)
match_op(OP_TIME,TIME)
+ match_op(OP_ATAN2,ATAN2)
match_op(OP_ATAN,ATAN)
match_op(OP_SQRT,SQRT)
match_op(OP_SORT,SORT)
match_op(OP_REV,REV)
match_op(OP_TREND,TREND)
+ match_op(OP_RAD2DEG,RAD2DEG)
+ match_op(OP_DEG2RAD,DEG2RAD)
#undef match_op
stackunderflow(0);
rpnstack -> s[stptr] = atan(rpnstack -> s[stptr]);
break;
+ case OP_RAD2DEG:
+ stackunderflow(0);
+ rpnstack -> s[stptr] = 57.29577951 * rpnstack -> s[stptr];
+ break;
+ case OP_DEG2RAD:
+ stackunderflow(0);
+ rpnstack -> s[stptr] = 0.0174532952 * rpnstack -> s[stptr];
+ break;
+ case OP_ATAN2:
+ stackunderflow(1);
+ rpnstack -> s[stptr-1]= atan2(
+ rpnstack -> s[stptr-1],
+ rpnstack -> s[stptr]);
+ stptr--;
+ break;
case OP_COS:
stackunderflow(0);
rpnstack -> s[stptr] = cos(rpnstack -> s[stptr]);
index 56348db428fad4db0785b3931fcbe1930b376aca..146e2aa087bec1a3769f7cc291303e0d67a0fcb9 100644 (file)
OP_COS,OP_LOG,OP_EXP,OP_LT,OP_LE,OP_GT,OP_GE,OP_EQ,OP_IF,
OP_MIN,OP_MAX,OP_LIMIT, OP_FLOOR, OP_CEIL,
OP_UN,OP_END,OP_LTIME,OP_NE,OP_ISINF,OP_PREV_OTHER,OP_COUNT,
- OP_ATAN,OP_SQRT,OP_SORT,OP_REV,OP_TREND};
+ OP_ATAN,OP_SQRT,OP_SORT,OP_REV,OP_TREND,
+ OP_ATAN2,OP_RAD2DEG,OP_DEG2RAD};
typedef struct rpnp_t {
enum op_en op;