⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 etipool.c

📁 Many C samples. It is a good sample for students to learn C language.
💻 C
字号:
/* Etipool */
#include <conio.h>
#include <graphics.h>
#include <math.h>
#include <stdlib.h>

/* 1 / sqrt(2) */
#define FCT 0.7071067
/* he so doi tu do sang radian */
#define RADS 0.017453293
#define XRADIUS 200.0
#define YRADIUS 150.0
#define DOT(a,b) ((a)*(b) + (a)*(b))
#define DOT2(ax,ay,bx,by) ((ax)*(bx) + (ay)*(by))

double sx, sy, cx, cy, xc, yc, t, thit;

void drawray(double *sx, double *sy, double *cx, double *cy, double t)
{
  moveto(*sx, *sy);
  *sx = *sx + *cx * t;
  *sy = *sy + *cy * t;
  lineto(*sx, *sy);
}

void tinh_hit(double *thit)
{
  double A, B, C, delta;

  A = (cx/XRADIUS)*(cx/XRADIUS) + (cy/YRADIUS)*(cy/YRADIUS);
  B = 2 * ((sx-xc)*cx/(XRADIUS*XRADIUS) + (sy-yc)*cy/(YRADIUS*YRADIUS));
  C = ((sx-xc)/XRADIUS)*((sx-xc)/XRADIUS) + ((sy-yc)/YRADIUS)*((sy-yc)/YRADIUS) - 1.0;

  /* Ta phai giai he phuong trinh At

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -