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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:56:32+00:00 2026-05-11T17:56:32+00:00

All Points are Vectors, and all Vectors are Points. All Directions are Vectors, NOT

  • 0
  • All Points are Vectors, and all Vectors are Points.
  • All Directions are Vectors, NOT all Vectors are Directions (this shouldn’t mean both way conversion shouldn’t be allowed).

I want to have the operators overridden once for all preferably since they’re all completely identical. In C++ I can just define class Vector { float x,y,z; }, and do typedef Point = Vector, typedef Direction = Vector; In C# there is no equivalent (“using Point=Vector;” sucks as you have to place it in every single document you use, and it’s not enforced by the compiler).

I tried to define 3 different classes and override the operators for each, then do implicit type casting which would make the code run slower, etc.

I tried defining just Vector, then Point:Vector and Direction:Vector, this way I only write the operators once but then I can’t do implicit type casting Point <-> Vector or Direction <->Vector.

I could simply define the Vector class and use that everywhere, but that would create ambiguity as to weather a variable is supposed to be a position in space (Point), a relative position in space (Vector) or a unit vector (Direction). For example the function:

Vector GetOrthogon(Vector a, Vector b) {
    // ....
}

You can’t know whether it’s expecting any vectors or unit vectors. In C++ you could do that, so why not in C#?

Note: having structs instead of classes would be ideal if possible.

  • 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-11T17:56:32+00:00Added an answer on May 11, 2026 at 5:56 pm

    Mathematically, Points are Vectors. There are no absolute points in space. Points are defined as vectors from some arbitrary origin. So, I use Vectors for both points and differences between points.

    Because a direction is a unit vector, there’s no need for a distinction there either. It’s like trying to define different static types for the integer 1 and other integers. So I use vectors for both directions and differences between points.

    So, define a single Vector type. It’ll make your life easier because you’ll have fewer classes and overloaded operators/functions to write and test and will be mathematically “purer” (if that matters to you).

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

Sidebar

Related Questions

I have a code where I want to loop over all points in a
i have a file with the points for all the states. i want to
So first of all I have such image (and ofcourse I have all points
I am processing a series of points which all have the same Y value,
I have a database with Points of Interest that all have an address. I
I have a shell variable which points to the directory where all my configuration
I have a set of data points in 3D space which apparently all fall
(This is not exactly the problem that I have, but it's isomorphic, and I
So, I have a set of position vectors (points, essentially). How can I find
Operation A I have N vectors, each containing certain number of unique 3D points.

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.