MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / GetStepIndex

Method GetStepIndex

Source/CircleSequencer.cpp:252–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252int CircleSequencerRing::GetStepIndex(int x, int y, float& radiusOut)
253{
254 ofVec2f polar = CarToPol(x - 100, y - 100);
255 float pos = FloatWrap(polar.x + mOffset, 1);
256 int idx = int(pos * mLength + .5f) % mLength;
257
258 ofVec2f stepPos = PolToCar(float(idx) / mLength - mOffset, GetRadius());
259 if (ofDistSquared(x, y, stepPos.x + 100, stepPos.y + 100) < 7 * 7)
260 {
261 radiusOut = polar.y;
262 return idx;
263 }
264
265 return -1;
266}
267
268void CircleSequencerRing::OnClicked(float x, float y, bool right)
269{

Callers

nothing calls this directly

Calls 4

FloatWrapFunction · 0.85
ofDistSquaredFunction · 0.85
CarToPolFunction · 0.70
PolToCarFunction · 0.70

Tested by

no test coverage detected