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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:43:34+00:00 2026-06-10T14:43:34+00:00

I have a quad type which is defined as: typedef struct __point { float

  • 0

I have a quad type which is defined as:

typedef struct __point {
    float x;
    float y;
} point_t;

typedef struct __quad {
    point_t p1;
    point_t p2;
    point_t p3;
    point_t p4;
} quad_t;

If I have two of those quads on the same plane, I would like to be able to work out the intersection points of those quads. For example, if we have quad A and quad B, if any of B’s points fall outside of A, the algoritm should yield a quad with points as shown in the illustration below (A is in red, B is in purple):

Example

Edit: Ordering of the points is not important because I will later use those points to construct a quad that is going to be drawn inside A.

  • 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-10T14:43:36+00:00Added an answer on June 10, 2026 at 2:43 pm

    If the only reason to do this is to draw the resulting polygon, why not use the GPU to do the work for you – you’re using OpenGL after all. So instead of messing about working out how to construct the intersection, do the following:-

    Set Z values of Polygon A and Polygon B to some constant
    
    Set Z test to no testing (always write Z regardless)
    
    Disable Z test
    Enable Z writes
    Disable colour writes
    Render Polygon A
    
    Set Z test to z equal
    
    Enable Z test
    Disable Z write
    Enable colour write
    Render Polygon B
    

    Hey presto, the intersection polygon!

    You could probably make this far more efficient if you restricted yourself to OpenGL 4 and used the various shaders that are available.

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

Sidebar

Related Questions

If I have a class like this: typedef union { __m128 quad; float numbers[4];
What i have now #define QUAD_VERT_COUNT 4 #define QUAD_POS_COMP 3 typedef struct quad_pos {
I have server with two quad core processors, installed windows 2003 standard edition. I
I have an image with 2D projection(green one) of a 3D quad(blue one), like
have written this little class, which generates a UUID every time an object of
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
Have deployed numerous report parts which reference the same view however one of them
I have a quad and I would like to use the gradient it produces
When I have a QUAD at a certain position, how can I rotate it
I have a billboard quad with a texture mapped onto it. This is basically

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.