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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:34:27+00:00 2026-06-01T10:34:27+00:00

I saved group of points on my panel to List<MyVector> savedPoints , then I

  • 0

I saved group of points on my panel to List<MyVector> savedPoints, then I calculated the the point with lowest coordinate y :

 public void searchLowest()  
    {
        MyVector temp;
        double ylon = savedPoints[0].getY();
        for (int i = 0; i < savedPoints.Count; i++)
        {
            if (savedPoints[i].getY() > ylon)
            {
                ylon = savedPoints[i].getY();
                lowest = i;
            }
        }

        temp = savedPoints[lowest];
    }

after this I made a method to calculate polar angles :

public static double angle(MyVector vec1, MyVector vec2) 
        {
            double angle = Math.Atan2(vec1.getY() - vec2.getY(), vec1.getX() - vec2.getX());
            return angle;
        }

now don’t know how to use Gift wrapping algorithm in my case. The pseudocode on WikiPedia link is not really understandable for me, so I’m asking for help here.

I’m using C# and win forms (net.framework 4.0)

Thanks for any help.

  • 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-01T10:34:28+00:00Added an answer on June 1, 2026 at 10:34 am

    Using this as a reference, here is teh code:

    namespace GiftWrapping
    {
        using System.Drawing;
        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Text;
    
        class Program
        {
            static void Main(string[] args)
            {
                List<Point> test = new List<Point>(
                    new Point[]
                        {
                            new Point(200,200), new Point(300,100), new Point(200,50), new Point(100,100),
                            new Point(200, 100), new Point(300, 200), new Point(250, 100), 
                        });
    
                foreach (Point point in ConvexHull(test))
                {
                    Console.WriteLine(point);
                }
    
                Console.ReadKey();
    
            }
    
            public static List<Point> ConvexHull(List<Point> points)
            {
                if (points.Count < 3)
                {
                    throw new ArgumentException("At least 3 points reqired", "points");
                }
    
                List<Point> hull = new List<Point>();
    
                // get leftmost point
                Point vPointOnHull = points.Where(p => p.X == points.Min(min => min.X)).First();
    
                Point vEndpoint;
                do
                {
                    hull.Add(vPointOnHull);
                    vEndpoint = points[0];
    
                    for (int i = 1; i < points.Count; i++)
                    {
                        if ((vPointOnHull == vEndpoint)
                            || (Orientation(vPointOnHull, vEndpoint, points[i]) == -1))
                        {
                            vEndpoint = points[i];
                        }
                    }
    
                    vPointOnHull = vEndpoint;
    
                }
                while (vEndpoint != hull[0]);
    
                return hull;
            }
    
            private static int Orientation(Point p1, Point p2, Point p)
            {
                // Determinant
                int Orin = (p2.X - p1.X) * (p.Y - p1.Y) - (p.X - p1.X) * (p2.Y - p1.Y);
    
                if (Orin > 0)
                    return -1; //          (* Orientation is to the left-hand side  *)
                if (Orin < 0)
                    return 1; // (* Orientation is to the right-hand side *)
    
                return 0; //  (* Orientation is neutral aka collinear  *)
            }
        }
    }
    

    adaptation to your private classes, would be your homework.

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

Sidebar

Related Questions

I have a large set of data saved in a long list. This is
When an application's process is killed, its activity stack is saved. Then when the
How can I group a query result by a field that is not saved
I saved some data in the database using mysql_real_escape_string() so the single quotes are
I saved my project.apk file, and I was reading this document: http://developer.android.com/guide/publishing/app-signing.html#setup and they
I have this strings saved in my mysql database in format like: /uploads/attachments/18/105/WordPress_3_Cookbook.pdf Now,
I have never saved and retrieved an image to and from the database before.
I have saved an html page using the following line of code : NSURL
What is saved into AUC file (cache file) of Axapta / Dynamics Ax 2009?
The data is saved in a .txt . There are 200 words saved in

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.