Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8090117

Browse files
remap to linearMapping, args renamed
1 parent 5c754cc commit 8090117

File tree

7 files changed

+53
-73
lines changed

7 files changed

+53
-73
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Linear Remappibg
3+
description: remaps a value from one range to another
4+
author: JasimAlrawie
5+
tags: math,number-theory,algebra
6+
---
7+
8+
```c
9+
10+
float linearMapping(float value, float minIn, float maxIn, float minOut, float maxOut) {
11+
return (v-minIn) * (maxOut - minOut)/(maxIn - minIn) + minOut
12+
}
13+
14+
15+
// Usage:
16+
linearMapping(value, 0, 1, 0, 255) // remaps the value from (0,1) to (0,255)
17+
linearMapping(value, 0, PI*2, 0, 360) // remaps the value from rad to deg
18+
linearMapping(value, -1, 1, 1, 8) // remaps the value from (-1,1) to (1,8)
19+
```

‎snippets/c/mathematical-functions/remap.md‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎snippets/cpp/math-and-numbers/remap.md‎

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Linear Remapping
3+
description: remaps a value from one range to another
4+
author: JasimAlrawie
5+
tags: math,number-theory,algebra
6+
---
7+
8+
```js
9+
function linearMapping(value, minIn, maxIn, minOut, maxOut) {
10+
return (v-minIn) * (maxOut - minOut)/(maxIn - minIn) + minOut
11+
}
12+
13+
// Usage:
14+
linearMapping(value, 0, 1, 0, 255) // remaps the value from (0,1) to (0,255)
15+
linearMapping(value, 0, PI*2, 0, 360) // remaps the value from rad to deg
16+
linearMapping(value, -1, 1, 1, 8) // remaps the value from (-1,1) to (1,8)
17+
```

‎snippets/javascript/mathematical-functions/remap.md‎

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Linear Renapping
3+
description: remaps a value from one range to another
4+
author: JasimAlrawie
5+
tags: math,number-theory,algebra
6+
---
7+
8+
```py
9+
10+
def linearMapping(value, minIn, maxIn, minOut, maxOut):
11+
return (value - minIn) * (maxOut - minOut) / (maxIn - minIn) + minOut
12+
13+
// Usage:
14+
linearMapping(value, 0, 1, 0, 255) // remaps the value from (0,1) to (0,255)
15+
linearMapping(value, 0, PI*2, 0, 360) // remaps the value from rad to deg
16+
linearMapping(value, -1, 1, 1, 8) // remaps the value from (-1,1) to (1,8)
17+
```

‎snippets/python/math-and-numbers/remap.md‎

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /