Graphics 贝塞尔曲线控制点
我需要使用bezier曲线绘制像alpha(α)beta(β)和gamma(γ)这样的字符。 我无法找到正确的控制点组合。 那么,我应该对程序进行任何更改,还是完全更改它呢Graphics 贝塞尔曲线控制点,graphics,bezier,Graphics,Bezier,我需要使用bezier曲线绘制像alpha(α)beta(β)和gamma(γ)这样的字符。 我无法找到正确的控制点组合。 那么,我应该对程序进行任何更改,还是完全更改它呢 #include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> #include<stdlib.h> #include<process.h> #include<con
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
#include<process.h>
#include<conio.h>
#include<math.h>
#define POINTS 10
int x[POINTS],y[POINTS],no,endl,i,k;
double factorial(double number)
{
double product=1;
for(i=1;i<number;i++)
product*=i;
return product;
}
void getData()
{
printf("enter no. of points:");
scanf("%d",&no);
printf("enter points:%d",endl);
for(i=0;i<no;i++)
{
printf("x=%d ",i);
scanf("%d",&x[i]);
printf("y=%d ",i);
scanf("%d", &y[i]);
}
for(i=1;i<no;i++)
line(x[i-1],y[i-1],x[i],y[i]);
}
void Bezier()
{
double b=0,f=0;
double u=0.0001;
while(u<=1)
{
double xu=0,yu=0;
for(k=0;k<=no;k++)
{
f=factorial(no)/(factorial(k)*factorial(no-k));
b=pow(u,k)*pow((1-u),(no-k));
xu+=x[k]*f*b;
yu+=y[k]*f*b;
}
putpixel(xu,yu,WHITE);
u+=0.0001;
}
}
void main()
{
int gd=DETECT,gm;
clrscr();
initgraph(&gd,&gm,"C:\\TC\\BGI");
getData();
no--;
Bezier();
getch();
closegraph();
}
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#定义第10点
int x[点]、y[点]、no、endl、i、k;
双阶乘(双数)
{
双积=1;
对于(i=1;我为什么不只是在许多免费或付费的矢量绘图程序中先画出你想要的曲线,然后看看相关的坐标是什么?如果你需要设计字母,先设计,然后实现。或者至少先画一些东西,这样你可以猜错,但至少足够接近坐标。而且,这是一个使用您正在使用的语言/技术为您的帖子添加标签是个好主意。这看起来像是arduino代码。Alpha和Gamma可以使用四个控制点来完成,而不是Beta。您可以依赖这样的属性,即曲线与从第一个顶点到第二个顶点以及从第三个顶点到第四个顶点的线段相切。@YvesDaoust无法绘制Alpha或Beta..KEYP得到随机曲线。@蒙蒂,我看到的是代码> CUT<代码>和<代码> CIN < /代码>,所以你绝对不使用C。至少,你使用C++(非常不同的野兽)。但是再次:得到一些东西,只需画出你的曲线,然后看看坐标上的意思。给我们展示你的坐标。