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 6020851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:37:41+00:00 2026-05-23T03:37:41+00:00

Analyzing Eye-movements on a screen, I set my origin to the bottom left corner

  • 0

Analyzing Eye-movements on a screen, I set my origin to the bottom left corner of it
(Hard to modify at that point).

Trying to compute distance between some points and the center of the screen I use the simple formula displayed below.
Problem is that using this in conditional statement, it gets ugly.

Sqrt[
(
(fixationX - centerX)^2 + (fixationY - centerY)^2
)
]

Is there a way to customize Norm to compute distance between points and not between a point and the origin ?

Or in my case, set the origin to be at the “center” of the current coordinate system ?

  • 1 1 Answer
  • 0 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-23T03:37:42+00:00Added an answer on May 23, 2026 at 3:37 am

    A slight variation of Simon’s method is to use a default value in the function, rather than a global variable ($Center).

    Suppose your default origin is (5, 5), then:

    myNorm[pos:{_, _}, center_:{5, 5}] := EuclideanDistance[pos, center]
    

    Notice the use of _:{5, 5} to define the default value.

    Now you can do:

    myNorm[{5, 7}]
    
    (* Out[]= 2 *)
    

    Or temporarily use a different the center with:

    myNorm[{5, 7}, {8, 8}]
    
    (* Out[]= Sqrt[10] *)
    

    For this simple function, you could use EuclideanDistance in the second case instead, but I hope you can see the utility of this method were the definition of myNorm more complex.

    The downside to this method is that you cannot easily change the default center.


    Another variation that does allow one to easily change the default center, but is more verbose, is to use Options:

    Options[myNorm2] = {Center -> {5, 5}};
    
    myNorm2[pos : {_, _}, OptionsPattern[]] := 
     EuclideanDistance[pos, OptionValue[Center]]
    

    Syntax is:

    myNorm2[{5, 7}]
    
    myNorm2[{5, 7}, Center -> {8, 8}]
    
       2
       Sqrt[10]

    Changing the default center:

    SetOptions[myNorm2, Center -> {8, 8}];
    
    myNorm2[{5, 7}]
    
       Sqrt[10]
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am analyzing a .dmp file that was created and I have a call
I assume that most of the analyzing and tracking is done based on the
After analyzing my site with the websiteoptimization.com tool , I see that it lists
I am analyzing someone else's PHP code and I've noticed that the input HTML
Can somebody suggest a good free tool for analyzing .Net memory dumps other than
Does Ruby have any tools along the lines of pylint for analyzing source code
Since yesterday, I am analyzing one of our project with Ndepend (free for most
What are some good tools for getting a quick start for parsing and analyzing
Analyzing the location.hash with this simple javascript code: <script type="text/javascript">alert(location.hash);</script> I have a difficult
While analyzing some ASP.NET MVC projects I got to see anonymous types scattered all

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.