Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 606555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:16:00+00:00 2026-05-13T17:16:00+00:00

I have a function that will take a range of values, which need to

  • 0

I have a function that will take a range of values, which need to be normalized to the range [-1, 1]. MathHelper.Clamp() just takes values that are outside the range and sets them to be whichever bound it exceeds. Does XNA or C# have anything that does what I’m looking for? (I’m looking through the documentation but can’t find it.)

This is the get mouse movement. The values are the difference in mouse coordinates between one tick and the next. I’m not sure what the max value for that is.

This function will take values one at a time – so there is no iterating over all values to scale them all or see what the min and max is.

This is what I currently have:

// max - min cannot == 0
private float normalizeToRange(float value, float min, float max) {
      return (2.0f * (value - min) / (max - min)) -1.0f;
}
  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:16:01+00:00Added an answer on May 13, 2026 at 5:16 pm

    Applying the formula 2*(x-min)/(max-min) + -1 to each value should normalize it for you.

    (x-min)/(max-min) gives you a value between 0 and 1

    multiplying by 2 gives you a value between 0 and 2

    subtracting 1 gives you a value between -1 and 1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a function that will take a string and pascal case it. The
I have a small function that will take a string of css (eg background:
I need to write a function that will take a variable number of arguments.
I need a function that will take in a list of characters and numbers,
Does someone have a good, fast SQL Server function that will take a string
I have one template function which will take a pointer type and i have
I have to devise a function that will take as input a keyword and
I have a function that will parse some data coming in. My problem is
I have a function that will allow me to edit the manager property of
I currently have a function that will create X tasks of a function based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.