Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem mit Koordinatenberechnung

Empfohlene Antworten

Veröffentlicht

Ich habe einen viertel Kreis und möchte die Koordinaten bei bestimmten Gradzahlen berechnen. Bei 0 und bei 90 Grad berechnet er die Koordinaten korrekt, jedoch bei allem anderen dazwischen nicht.

  private: int GetCoordX(int deg) {

    double sin = Math::Sin(deg*Math::PI/180);

    int round = Math::Round(sin*265.0);

    return (round+25);

  }

  private: int GetCoordY(int deg) {

    double cos = Math::Cos(deg*Math::PI/180);

    int round = Math::Round(cos*265.0);

    return (round+25);

  }

kann mir vielleicht jemand dabei helfen, wo ich den fehler gemacht habe?

es wird bei beiden +25 gerechnet, weil die komplette Grafik bei Koordinate 25/25 anfangen soll. 265 ist die breite der linie, die damit gezeichnet werden soll.

Mfg ShadowmanZ

  • Autor

sry für doppelpost, aber das Thema hat sich auch schon wieder erledigt. Ich habe wohl etwas gepennt und noch alte methoden verwendet

  private: int GetCoordX(int deg) {

    double cos = Math::Cos(deg*Math::PI/180);

    int round = Math::Round(cos*265.0);

    return (265-round+25);

  }

  private: int GetCoordY(int deg) {

    double sin = Math::Sin(deg*Math::PI/180);

    int round = Math::Round(sin*265.0);

    return (265-round+25);

  }

thema kann geschlossen werden

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.