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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:21:36+00:00 2026-05-18T23:21:36+00:00

I’m working on a 4-point image transformation for an application. The user would either

  • 0

I’m working on a 4-point image transformation for an application. The user would either drag each corner around to create a valid quadrilateral shape, or use its “bounding box” to resize it vertically, horizontally, and proportionally.

So far, I have the image transformation part working. However, I’m having a hard time imposing limitations to it so that…

  1. The vertices doesn’t cross over each other. In another words, I don’t allow the user to create an hour-glass shape. It must always be a quadrilateral.
  2. Likewise, the angle between each corner must be greater than 0. Otherwise, the vertices will end up in a line.
  3. It has a minimum size on this image. That is, each corner has to be a certain distance away from each other, and their opposing lines.
  4. The user cannot “flip” the image to its backside. The 4 corners (p1, p2, p3, and p4) must appear in clockwise order.
  5. Concave kite shapes and triangles are valid.

I was wondering if there was a formula or a paper regarding these issues. I do currently have the formulas for finding if 2 line segments intersect (and where), as well as finding the closest point on a line to another point. Most of my implementations hasn’t been user-friendly as I liked, as the corners would jump all over the place when imposing restrictions.

P.S. I’m using C# for this project, with DirectX. The application is solely 2D, however.

  • 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-18T23:21:37+00:00Added an answer on May 18, 2026 at 11:21 pm

    My suggestion is not to impose restriction but just drawing say just a red wireframe polygon if for you it’s unacceptable.

    It’s more or less like when programmers put restriction on form input fields e.g. begin date must come before end date and don’t allow you to type in a date in the begin field that’s after the date in the end field… forcing users to tab to end field first, then entering the end date, then tabbing back to the begin field to enter the correct begin date.

    Just showing the fields in red is MUCH more usable… and actually requires less coding.

    Trapping user mouse movements is rarely a sensible idea. If you can’t apply what user is asking just make this evident instead of constraining the movement… may be the user is moving the first vertex and wants to move another vertex later to a position that will make your transform valid (exactly like the two date fields example).

    If you really think you MUST prevent invalid positions at all times (and that for example will forbid the user from flipping the image even if your transform would allow a flipping operation without problems) then the simplest solution that comes to my mind is just having an isValid() function and just not moving the keypoint to the new position if it’s invalid.

    Having code that “slides” around invalid state space areas is IMO quite difficult to handle nicely, also because invalid areas are going to be quite close to “almost invalid” areas.
    Even in case “sliding” is a requirement I’d probably go for implementing an implicit isValid() approach by doing a local search around the keypoint position to find what is the closest valid point to the point the user is asking for.

    Explicitly computing all sliding possibilities would be a nightmare to get correct and also to maintain if you need to change something in the transformation algorithm (and consequently in what is valid and what is not).

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.