Skip to content

Commit 9d29780

Browse files
committed
Add norm() function (missing from Processing Java API)
1 parent 5360372 commit 9d29780

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/Processing.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3593,6 +3593,8 @@ inline float constrain(V val,A lo,B hi){ return _api::constrain((float)val,(floa
35933593
template<typename A,typename B,typename C,
35943594
typename=::std::enable_if_t<::Processing::_is_numeric_v<A>&&::Processing::_is_numeric_v<B>&&::Processing::_is_numeric_v<C>>>
35953595
inline float lerp(A a,B b2,C t){ return _api::lerp((float)a,(float)b2,(float)t); }
3596+
template<class V,class A,class B>
3597+
inline float norm(V value,A start,B stop){ return map((float)value,(float)start,(float)stop,0.0f,1.0f); }
35963598

35973599
// bezier() -- 8 arithmetic params
35983600
template<typename A,typename B,typename C,typename D,

0 commit comments

Comments
 (0)