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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:42:38+00:00 2026-05-31T05:42:38+00:00

i would like to know if a point in a plane segment, and its

  • 0

i would like to know if a point in a plane segment, and its coordinate in [0,1][0,1] relative to segment. e.g 0,0 left bottom corner, 1,1 right top corner, 0.5,0.5 center

these are the thing i already know:

-point is in on the same plane as plane segment.
-coordinates of 4 points of the plane segment. but they are not clock-wise order or any order i would know.
-plane’s normal and its distance to origin. such as; ax + by + cz +d . x,y,z,d are known.

here is a sketch i did:
plane

A,B,C points are on same plane as plane segment. P1, P2, P3, P4 coordinates is known, but is not ordered in any meaningful way.

thank you.

edit:

one idea i have is

  • sort points

  • create vector between each points

  • create vectors from 2 points

  • dot product them

  • if degree is between 0 and 90, it’s inside

would this work? i need good real-time performance, isn’t dot product is slow on CPU?
how would i find relative coordinate of point?

  • 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-31T05:42:40+00:00Added an answer on May 31, 2026 at 5:42 am

    In my opinion the best way to check this is transforming the whole plane and the points to the origin of coordinate system: Translate every point so the left bottom point will be in the center of coordinate system, and rotate everything so the normal vector will be pointing parallel with one of the axes. This means a matrix multiplication for every point, but after this you can easily check which points are in the rectangle. This is an XNA C# implementation, but the logic is the same everywhere: (I tried to use your sketch for inputs)

    // Inputs - Right handed coordinate system
    Vector3 p1 = new Vector3(-1.0f, 1.0f, 1.0f);  // left top
    Vector3 p2 = new Vector3(1.0f, -1.0f, 0.0f);  // right bottom
    Vector3 p3 = new Vector3(1.0f, 1.0f, 1.0f);   // right top, redundant if this is a rectangle
    Vector3 p4 = new Vector3(-1.0f, -1.0f, 0.0f); // left bottom
    
    Vector3 a = new Vector3(-0.5f, 0.0f, 0.5f);
    
    // Calculating transformation matrix
    Vector3 right = Vector3.Normalize(p2 - p4);
    Vector3 forward = Vector3.Normalize(p1 - p4);
    Vector3 up = Vector3.Cross(right, forward);
    
    Matrix transform = new Matrix();
    transform.M11 = right.X;
    transform.M12 = right.Y;
    transform.M13 = right.Z;
    transform.M14 = 0.0f;
    transform.M21 = forward.X;
    transform.M22 = forward.Y;
    transform.M23 = forward.Z;
    transform.M24 = 0.0f;
    transform.M31 = up.X;
    transform.M32 = up.Y;
    transform.M33 = up.Z;
    transform.M34 = 0.0f;
    transform.M41 = p4.X;
    transform.M42 = p4.Y;
    transform.M43 = p4.Z;
    transform.M44 = 1.0f;
    
    transform = Matrix.Invert(transform);
    
    // Transforming
    Vector3 tp1 = Vector3.Transform(p1, transform);
    Vector3 tp2 = Vector3.Transform(p2, transform);
    Vector3 tp3 = Vector3.Transform(p3, transform);
    Vector3 tp4 = Vector3.Transform(p4, transform);
    Vector3 ta = Vector3.Transform(a, transform);
    
    ta.X /= tp2.X; // divide with rectangle width
    ta.Y /= tp1.Y; // divide with rectangle height
    
    // Now everything is on the XY plane
    // P1: {X:0    Y:2.236068 Z:0}
    // P2: {X:2    Y:0        Z:0}
    // P3: {X:2    Y:2.236068 Z:0}
    // P4: {X:0    Y:0        Z:0}
    // A:  {X:0.25 Y:0.5      Z:0}
    

    This works on any four points.

    It’s not the fastest solution, but I’m sure it’s the cleanest and simplest if you know matrix transformations. If you find any faster and yet simple solution I’m interested too, but probably there will be no performance issues. On my Intel 2.4ghz processor this computation happens more than 1 million times under 1 second without any problem. Hope this helps, good luck!

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

Sidebar

Related Questions

I would like to know how the Cocoa Framework got its name. I know
I would like to know how the recycle image link works, it points to
i would like know some reference. I know i can googling it. but prefer
Would like to know what a programmer should know to become a good at
Would like to know the c# code to actually retrieve the IP type: Static
Would like to know how to integarate cruise control with maven? Cruise Control comes
Would like to know how to hide an div after a set of css3
I would like to know what guys are using to make diagram of your
I would like to know how to define a returntype in a function in
I would like to know if there's an efficient algorithm to find the greatest

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.