0

Sorry if I don't make much sense, I don't know the English terms of these things.

User inputs the number of N of an N-sided shape and then their points (x,y).

After, I need to create a function that checks if that N-Sided shape is Convex (Curve?) or not.

I have only managed to ask for N and the points so far.

#include <stdio.h> 
#include <math.h> 

typedef struct point 
{
    float x;    
    float y; 
} TPoint; 

int main( void ) 
{ 
    TPoint p[20]; 
    float d; 
    int n, i; 
        
    printf("Number of sides ?\n"); 
    scanf("%d",&n); 

    for(i=0;i<n;i++) 
    {
        printf("Point %d (x,y) ?\n",i+1); 
        scanf("%f", &p[i].x); 
        scanf("%f", &p[i].y); 
    } 
    
    return 0; 
} 
Yun
  • 3,056
  • 6
  • 9
  • 28
  • 1
    You need to implement one of the many algorithms for solving your problem (e.g. https://www.geeksforgeeks.org/convex-hull-set-1-jarviss-algorithm-or-wrapping/). No one can take from you this decision. I am afraid, you will not get a concrete answer for your question here. – YesThatIsMyName Sep 15 '21 at 11:12
  • 1
    Got ya. I have an answer from the link posted above. It's most certainly wrong but nonetheless it's something. Thanks! – Marasha Sep 15 '21 at 15:58

0 Answers0