Raised This Month: $51 Target: $400
 12% 

Geometry to create circle


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Furibaito
Member
Join Date: Aug 2012
Location: Colossal Titan
Old 07-16-2013 , 11:53   Geometry to create circle
Reply With Quote #1

Well..... this is a Geometry question but it's connected to scripting =D
Big thanks to zeroibis. I'm currently using one of his stocks. To make a circle laser (Different from TE_SetupBeamRing(Point)). Note that the PI already defined 3.1415926535897932384626433832795
PHP Code:
/*
 * DRAW A VERTICAL CIRCLE
 * 
 * NOTE MUST PLACE OnMapStart_Circle() in OnMapStart of program to use
 *
 * @param Float:vecLocation[3]        Location of circle.
 * @param Float:radius                Radius of circle.
 */
stock Circle(Float:vecLocation[3], Float:radius)
{
    new 
Float:angle=0.0Float:xFloat:y;
    
    new 
Float:pos1[3];
    new 
Float:pos2[3];
        
    
//Create the start position for the first part of the beam
    
pos2[0] = vecLocation[0];
    
pos2[1] = vecLocation[1] + radius;
    
pos2[2] = vecLocation[2];
    
    while (
angle <= PI)
    {            
        
radius Cosine(angle);
        
radius Sine(angle);
        
        
pos1[0] = vecLocation[0];
        
pos1[1] = vecLocation[1] + x;
        
pos1[2] = vecLocation[2] + y;

        
TE_SetupBeamPoints(pos1pos2BeamSpriteCircleHaloSpriteCircle008.0Float:5.0Float:5.050.0, {255,255,255,255}, 3);
        
TE_SendToAll();
        
        
pos2[0] = pos1[0];
        
pos2[1] = pos1[1];
        
pos2[2] = pos1[2];
        
        
angle += 0.7;
    }

I'm currently want to make 20 entities arranged in a half circle shape by learning out of this stock. But I haven't learn much in Geometry in school. So what actually this loop do?

PHP Code:
while (angle <= PI)
    {            
        
radius Cosine(angle);
        
radius Sine(angle);
        
        
pos1[0] = vecLocation[0];
        
pos1[1] = vecLocation[1] + x;
        
pos1[2] = vecLocation[2] + y;

        
TE_SetupBeamPoints(pos1pos2BeamSpriteCircleHaloSpriteCircle008.0Float:5.0Float:5.050.0, {255,255,255,255}, 3);
        
TE_SendToAll();
        
        
pos2[0] = pos1[0];
        
pos2[1] = pos1[1];
        
pos2[2] = pos1[2];
        
        
angle += 0.7;
    } 
I is pretty sure that this loops creates a very short beams what is looped until it reach a circle. But I don't understand how. I thought Trigonometry is to calculate Triangle Angles or the ratio of two sides of a triangle. What does it do with a circle?? Or maybe you can explain what this whole loop do? ^^

Thanks for readin
__________________
フリー

Currently making : ZRiot - like mod in CS:GO - - 45%

Can do private plugins or private community maps for small money.
Furibaito is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode