-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlsystem.h
64 lines (52 loc) · 2 KB
/
lsystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once
/* Copyright (c) 2008-2023 Alexey Ozeritskiy
* All rights reserved.
*/
struct Group;
int group_check(struct Group* g);
double group_get_angle(struct Group* g);
double group_get_angle_init(struct Group* g);
const char* group_get_axiom(struct Group* g);
const char* group_get_var(struct Group* g, int key);
const char* group_get_name(struct Group* g);
int group_get_order(struct Group* g);
struct Group* group_next(struct Group* g);
struct StringListItem* group_mgl_start(struct Group* g);
struct Parser;
typedef void (*log_function_t)(void* user_data, const char* text);
struct Parser* parser_new(log_function_t log, void* log_user_data);
void parser_free(struct Parser* parser);
void parser_push(struct Parser* parser, const char* str);
void parser_set_axiom(struct Parser* parser, const char* str);
void parser_set_angle(struct Parser* parser, double a);
void parser_set_angle_init(struct Parser* parser, double a);
void parser_add_rule(struct Parser* parser, char k, const char* str);
void parser_set_order(struct Parser* parser, double n);
void parser_set_error(struct Parser* parser, const char* str, int lineno);
void parser_print(struct Parser* parser);
void parser_check(struct Parser* parser);
struct Group* parser_group_start(struct Parser* parser);
int parser_has_error(struct Parser* parser);
int parser_get_error_line(struct Parser* parser);
int yyparse(struct Parser * );
char* lsystem(struct Group* gr, int level);
struct Line {
double x0;
double y0;
double x1;
double y1;
int c;
};
struct Lines {
struct Line* lines;
int n;
int cap;
};
void turtle(struct Lines* lines, struct Group* p, const char* W);
void lines_normilize(struct Line* lines, int n, double* mnx, double* mxx, double* mny, double* mxy);
void lines_save_png(
const char* name, struct Line* lines, int n,
double min_x, double max_x, double min_y, double max_y, int w, int h);
void lines_save_txt(
const char* name, struct Line* lines, int n,
double min_x, double max_x, double min_y, double max_y);