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

  • Home
  • SEARCH
  • 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 8229831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:55:51+00:00 2026-06-07T16:55:51+00:00

In C# I have the following code: Vector2.Dot(ref tmpDirection, ref direction, out result); This

  • 0

In C# I have the following code:

Vector2.Dot(ref tmpDirection, ref direction, out result);

This returns a float between -1 and 1. I am curious how to get this same functionality in Objective-C. I know you can calculate the dot product of two vectors like so:

CGPoint point1 = CGPointMake(10, 10);
CGPoint point2 = CGPointMake(20, 20);
float dotProduct = point1.x * point2.x + point1.y + point2.y;

What I do not understand is what the C# function does to make the result between -1 and 1 as normal dot product math can result in any number.

  • 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-06-07T16:55:54+00:00Added an answer on June 7, 2026 at 4:55 pm

    All you need to do to get this normalized from [-1,1] is to divide by the product of the magnitudes:

    float mag1 = sqrt(point1.x*point1.x + point1.y*point1.y);
    float mag2 = sqrt(point2.x*point2.x + point2.y*point2.y);
    dotProduct = (dotProduct)/(mag1*mag2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that I use to compute the distance between two
I have the following code: public class Character { public Vector2 WorldPixelPosition { get
I have the following code (compiler: MSVC++ 10): std::vector<float> data; data.push_back(1.0f); data.push_back(1.0f); data.push_back(2.0f); //
I have the following code: (please pardon the length of this code). I am
I have the following code, z <- data.frame(a=sample.int(10),b=sample.int(10),c=sample.int(10)) letter <- c(a,c,b) # this will
I have the following code: void foo() { vector<double> v(100,1); // line 1 //
I have the following code: #include <iostream> #include <vector> using namespace std; struct A{};
I have the following C++ code: typedef istream_iterator<string> isi; // (1) vector<string> lineas(isi(cin), isi());
In the following code, i have a method to get a Vector of persons
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig

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.