LoginSignup
3
4

More than 5 years have passed since last update.

ofMap() 使い方メモ

Posted at

値の調整でよく目にするけど謎だったofMapの使い方メモ。
範囲変換に使うらしいです。
Processingだとmap()

sample.cpp
// ofMap(hoge, a, b, c, d) hogeを範囲a-bから別の範囲c-dへ変換する

float hoge = 2.0;

//hogeを範囲0-10から別の範囲0-100へ変換する
float mapedHoge = ofMap(hoge, 0, 10, 0, 100)

cout << mapedHoge << endl;   // mapedHoge は 20
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4