Post Reply 
multi criteria IF statement
06-12-2021, 02:28 PM
Post: #8
RE: multi criteria IF statement
Don't forget to handle points on the vertical axis, including the origin. I'll arbitrarily assign 0 to atan(0,0). I haven't had nearly enough coffee yet and I'm not fluent in PPL, but in C++:

Code:
        if (x==0) {
            if (y == 0)
                n = 0;      // at the origin
            else
                n = 90 + 180*(y<0);  // on the y axis
        } else {
            // C++ atan() returns radians, so convert to degrees
            n = atan(y/x) * 180 / 3.141592653589792; // assume 1st quadrant
            if (x < 0) n += 180;    // adjust for quadrants 2 and 3
            else if (y < 0) n += 360; // adjust for quadrant 4
        }
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
multi criteria IF statement - Amer7 - 06-11-2021, 11:06 AM
RE: multi criteria IF statement - Amer7 - 06-11-2021, 11:59 AM
RE: multi criteria IF statement - Dougggg - 06-12-2021, 03:05 AM
RE: multi criteria IF statement - Joe Horn - 06-13-2021, 01:10 PM
RE: multi criteria IF statement - David Hayden - 06-12-2021 02:28 PM



User(s) browsing this thread: 2 Guest(s)