void TimeFace::OnPaintAll(Bitmap *destination) { int w = destination->Width(); int h = destination->Height(); int cx = w / 2; int cy = h / 2; destination->FillRect(0, 0, w, h, false); { char buf[10]; int y = cy + 10; MetaWatch_Combined_8pt.Print(destination, 20, y, daysOfWeek[GetRTCDOW()]); goodsprintf(buf, "%i/%2i", GetRTCDAY(), GetRTCMON() ); y += MetaWatch_Combined_8pt.Height(); MetaWatch_Small_8pt.Print(destination, 20, y, buf); goodsprintf(buf, "%4i", GetRTCYEAR() ); y += MetaWatch_Small_8pt.Height(); MetaWatch_Small_8pt.Print(destination, 20, y, buf); } // Clock markings for (int i = 0; i < 12; i++) DrawHand(destination, cx, cy, htTick, GetRadians(i, 12)); int hour = GetRTCHOUR() % 12; int minute = GetRTCMIN(); int second = GetRTCSEC(); // Hour int hourFull = (hour * 60) + minute; DrawHand(destination, cx, cy, htHour, GetRadians(hourFull, 12 * 60)); // Minute int minuteFull = (minute * 60) + second; DrawHand(destination, cx, cy, htMinute, GetRadians(minuteFull, 60 * 60)); // Second DrawHand(destination, cx, cy, htSecond, GetRadians(second, 60)); }
Vector4 CalcRayFromAngle(float AngleX, float Angley) { Vector4 result; GetRadians(AngleX, Angley); result.X = sin(Angley) * sin(AngleX); result.Y = cos(Angley); result.Z = sin(Angley) * cos(AngleX); return result; }
// ============================================================================ Value* AngleControl::get_property(Value** arg_list, int count) { Value* prop = arg_list[0]; if(prop == n_diameter || prop == n_width || prop == n_height) { if(parent_rollout && parent_rollout->page) return Integer::intern(GetDiameter()); else return &undefined; } else if(prop == n_degrees) { if(parent_rollout && parent_rollout->page) return Float::intern(GetDegrees()); else return &undefined; } else if(prop == n_radians) { if(parent_rollout && parent_rollout->page) return Float::intern(GetRadians()); else return &undefined; } else if (prop == n_range) { if(parent_rollout && parent_rollout->page) return new Point3Value (m_min, m_max, GetDegrees()); } else if(prop == n_startDegrees) { if(parent_rollout && parent_rollout->page) return Float::intern(GetStartDegrees()); else return &undefined; } else if(prop == n_startRadians) { if(parent_rollout && parent_rollout->page) return Float::intern(GetStartRadians()); else return &undefined; } else if(prop == n_dir) { if(parent_rollout && parent_rollout->page) return m_dirCCW ? n_CCW : n_CW; else return &undefined; } else if(prop == n_color) { if(parent_rollout && parent_rollout->page) return ColorValue::intern(AColor(m_color)); else return &undefined; } else if(prop == n_bitmap) return m_maxBitMap ? (Value*)m_maxBitMap : &undefined; return RolloutControl::get_property(arg_list, count); }
float nuiPadGestureRecognizer::GetDegrees() const { return 360.0 * GetRadians() / (2 * M_PI); }
TEST(mylibrary, degreesToRads) { float degreeConv = GetRadians(3); EXPECT_FLOAT_EQ(0.0523598776, degreeConv); }