GlistEngine
Loading...
Searching...
No Matches
gCircle.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Nitra Games Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * gCircle.h
19 *
20 * Created on: 9 Tem 2021
21 * Author: YavuzBilginoglu
22 */
23
24#ifndef GRAPHICS_PRIMITIVES_GCIRCLE_H_
25#define GRAPHICS_PRIMITIVES_GCIRCLE_H_
26
27#include "gMesh.h"
28
29/*
30 * Creates objects with the shape of a circle.
31 */
32class gCircle: public gMesh {
33public:
34
35 /*
36 * Creates objects with the shape of a circle.
37 * Calculating coordinate information.
38 * @param xCenter x-coordinate of the circle's center
39 * @param yCenter y-coordinate of the circle's center
40 * @param radius radius of the circle
41 * @param isFilled signifies whether the circle is full or empty
42 * @param numberOfSides indicates the detail value of the circle.
43 * @param rotateAngle rotation angle in radians
44 * @param pivotx rotation pivot x position ratio (0.0f - 1.0f)
45 * @param pivoty rotation pivot y position ratio (0.0f - 1.0f)
46 */
48 gCircle(float xCenter, float yCenter, float radius, bool isFilled, float numberOfSides = 64.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
49 virtual ~gCircle();
50
51 /*
52 * Provides draw using mesh class.
53 */
54 void draw();
55
56 void setPoints(float xCenter, float yCenter, float radius, bool isFilled, float numberOfSides = 64.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
57
58 /*
59 * Determines whether the projection is two-dimensional.
60 * The coordinates of the circle vertices created are taken.
61 * Provides draw using mesh class.
62 *
63 * @param xCenter x-coordinate of the circle's center
64 * @param yCenter y-coordinate of the circle's center
65 * @param radius radius of the circle
66 * @param isFilled signifies whether the circle is full or empty
67 * @param numberOfSides indicates the detail value of the circle.
68 * @param rotateAngle rotation angle in radians
69 * @param pivotx rotation pivot x position ratio (0.0f - 1.0f)
70 * @param pivoty rotation pivot y position ratio (0.0f - 1.0f)
71 */
72 void draw(float xCenter, float yCenter, float radius, bool isFilled, float numberOfSides = 64.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
73
74private:
75
76 /*
77 * The circle is formed by triangles.
78 * These triangles vertices form circle.
79 * Calculating coordinate information.
80 * The more sides are given, the sharper the circle will be, as the number of triangles will increase.
81 * But it does not provide any visible change after 64 sides given as default.
82 *
83 * @param xCenter x-coordinate of the circle's center
84 * @param yCenter y-coordinate of the circle's center
85 * @param radius radius of the circle
86 * @param isFilled signifies whether the circle is full or empty
87 * @param numberOfSides indicates the detail value of the circle.
88 * @param rotateAngle rotation angle in radians
89 * @param pivotx rotation pivot x position ratio (0.0f - 1.0f)
90 * @param pivoty rotation pivot y position ratio (0.0f - 1.0f)
91 */
92 void setCirclePoints(float xCenter, float yCenter, float radius, bool isFilled, float numberOfSides = 64.0f, float rotateAngle = 0.0f, float pivotx = 0.5f, float pivoty = 0.5f);
93};
94
95#endif /* GRAPHICS_PRIMITIVES_GCIRCLE_H_ */
virtual ~gCircle()
void draw()
void draw(float xCenter, float yCenter, float radius, bool isFilled, float numberOfSides=64.0f, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
gCircle(float xCenter, float yCenter, float radius, bool isFilled, float numberOfSides=64.0f, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)
void setPoints(float xCenter, float yCenter, float radius, bool isFilled, float numberOfSides=64.0f, float rotateAngle=0.0f, float pivotx=0.5f, float pivoty=0.5f)