Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canvas-drawing-app
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jalay
canvas-drawing-app
Commits
45a1c37f
Commit
45a1c37f
authored
Aug 20, 2021
by
Jalay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload new file
parent
16ed27d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
BEZ.C
BEZ.C
+53
-0
No files found.
BEZ.C
0 → 100644
View file @
45a1c37f
#include <graphics.h>
#include <conio.h>
#include <stdio.h>
double
bez
(
double
t
,
int
p
[],
int
a
,
int
b
)
{
if
(
a
==
b
)
return
p
[
a
];
else
return
(
1
-
t
)
*
bez
(
t
,
p
,
a
,
b
-
1
)
+
t
*
bez
(
t
,
p
,
a
+
1
,
b
);
}
void
main
(){
double
step
,
i
,
t
;
float
size
;
int
x0
=
10
,
n
,
y0
=
10
,
x1
=
100
,
y1
=
200
,
x2
=
300
,
y2
=
200
,
x3
=
100
,
y3
=
100
,
x
,
y
;
int
arrx
[
10
],
arry
[
10
];
int
gd
=
DETECT
,
gm
;
clrscr
();
printf
(
"enter the order of the curve:"
);
scanf
(
"%d"
,
&
n
);
printf
(
"enter the control points:"
);
for
(
i
=
0
;
i
<=
n
;
i
++
)
{
scanf
(
"%d %d"
,
&
arrx
[
i
],
&
arry
[
i
]);
}
initgraph
(
&
gd
,
&
gm
,
"..
\\
bgi"
);
setcolor
(
GREEN
);
step
=
500
;
size
=
1
.
0
/
(
double
)
step
;
moveto
(
arrx
[
0
],
480
-
arry
[
0
]);
for
(
i
=
1
;
i
<
step
;
i
++
){
t
=
size
*
(
double
)
i
;
x
=
bez
(
t
,
arrx
,
0
,
n
);
y
=
bez
(
t
,
arry
,
0
,
n
);
lineto
(
x
,
480
-
y
);
}
setcolor
(
CYAN
);
moveto
(
arrx
[
0
],
480
-
arry
[
0
]);
for
(
i
=
0
;
i
<=
n
;
i
++
)
{
lineto
(
arrx
[
i
],
480
-
arry
[
i
]);
}
// lineto(arrx[0],480-arry[0]);
for
(
i
=
0
;
i
<=
n
;
i
++
)
{
putpixel
(
arrx
[
i
],
480
-
arry
[
i
],
YELLOW
);
}
getch
();
closegraph
();
restorecrtmode
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment