您正在查看 "几何学算法" 分类下的文章 2009-07-06 23:25 #include<stdio.h>
#include<math.h>
#define MIN(x,y) (x < y ? x : y)
#define MAX(x,y) (x > y ? x : y)
typedef struct
{
double x,y;
} Point;
double mindistance(Point p1,Point p2,Point q)
{
int flag=1;
double k;
Point s;
if (p1.x==p2.x) { |
2009-07-06 22:56 #include<stdio.h>
#include<conio.h>
typedef struct
{
double x,y;
} Point;
int lineintersect(Point p1,Point p2,Point p3,Point p4)
{
Point tp1,tp2,tp3;
tp1.x=p1.x-p3.x;
tp1.y=p1.y-p3.y |
2009-07-06 22:05 #include <iostream>
#define min(x,y) (x<y?x:y)
#define max(x,y) (x>y?x:y)
using namespace std;
struct Point //端点
{
double x, y;
};
struct Line //线段
{
Point S, E;
};
//叉积
double mult(Point a, Point b, Point c)
{
return (a.x-c.x)*(b.y-c.y)-(b.x-c.x)*(a.y-c.y);
}
//aa, bb为一条线段两端点 cc, dd为另一条线 |
2009-07-06 20:19 #include<stdio.h>
#include<malloc.h>
#define MIN(x,y) (x<y?x:y)
#define MAX(x,y) (x>y?x:y)
typedef struct{
double x,y;
}Point;
int FC(double x1,double x2)
{
if(x1-x2<0.000002&&x1-x2>-0.000002)
return 1;
else
return 0;
}
int Pointonline(Point p1,Point p2,Point p)
{
double x1,y1,x2,y2;
x1=p.x-p1.x;
x2=p2.x-p1.x;
y1=p.y-p1. |
| | |