From ac8f5cfaa7a1752e7ba0e62aa40d4bc785e5be34 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 25 Oct 2022 18:32:17 +0300 Subject: [WGL/P04] Solved exercises 2-5 --- .../03-Practice-24.10.2022/Problem 0302.html | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Year 2/Computer Graphics with WebGL/03-Practice-24.10.2022/Problem 0302.html') diff --git a/Year 2/Computer Graphics with WebGL/03-Practice-24.10.2022/Problem 0302.html b/Year 2/Computer Graphics with WebGL/03-Practice-24.10.2022/Problem 0302.html index 9d60b02..cffaab6 100644 --- a/Year 2/Computer Graphics with WebGL/03-Practice-24.10.2022/Problem 0302.html +++ b/Year 2/Computer Graphics with WebGL/03-Practice-24.10.2022/Problem 0302.html @@ -10,16 +10,16 @@ // отвън се подава само ъгъла attribute float aAngle; #define PI 3.14159 - #define TEETH 30.0 - #define RADIUS 0.8 - + #define eps 0.0001 + #define TEETH 35.0 + #define RADIUS 0.7 + #define TEETH_DEPTH 0.1 + #define LEDGE_MODIFIER 2.0 + void main () { - // тук трябва да се сметне точния радиус - float r = RADIUS - mod(aAngle, 2.0 * PI / TEETH) * 0.4; - float angle = aAngle; - if (r == RADIUS) angle -= 100.0; - if (angle < 0.0) angle = 0.0; // ugly + float r = RADIUS + mod(aAngle, 2.0 * PI / TEETH) / ((360.0 / TEETH - 1.0) * PI / 180.0) * TEETH_DEPTH;; + float angle = aAngle - LEDGE_MODIFIER * r; gl_Position = vec4(r*cos(angle)/1.5,r*sin(angle),0,1); } @@ -52,6 +52,7 @@ var data = [ ]; for(var i=0; i