# SnippetvCircles

#### Dirac

##### 22710180
vCircles is a very useful snippet for spinning points around bidimensional cicles or tridimensional spheres. It's very fast and has the capacity of calculating distances across the circle's perimeter, so if you want to move a projectile for, lets say, 40 units around a perimeter, with vCircles you can.
JASS:
``````library vCircles
//**************************************************************************************************************************
//Snippet made by Dirac to avoid polar offset positioning
//  This creates a circle around a point with a base angle 0. this angle determines the offset location
//  of the point you might need to move or create something.

//Variables:
//  real x
//      -center X
//  real y
//      -center Y
//  real xyangle
//      -current angle in the x axis
//  real zangle
//      -current angle in the z axis

//  real offsetX
//      -the X depending on the circle's radius and current angle
//  real offsetY
//      -the Y depending on the circle's radius and current angle
//  real offsetZ
//      -the Z depending on the circle's height.
//  real xyspin
//      -the amount of spins done in the x axis.
//  real zspin
//      -the amount of spins done in the z axis.

//Setting up values
//      -Sets the xyangle base rotation to a value

//Methods:
//  static method create takes real x, real y, real z, real radius returns thistype
//          -Imput here the center x,y,z and radius, default angle is 0, you can change that later

//          -This method reduces or increases the radius lenght towards an angle
//          -The angle is measured starting from the edge of the circle, a few examples:
//            if the angle provided is 0 the radius would increase exactly by the amount provided,
//            if the angle provided is 180 the radius would decrease exactly by the amount provided,
//            if the angle provided is 90 the radius would increase sightly

//  method polarVector2d takes real howMuch, boolean clockwise returns nothing
//          -This method moves the circle angle around it's radius depending on the amount provided
//          -This is a very good way to avoid polar offset when you wan't to move something exactly
//          by an amount of distance around a point, not an angle.

//  method polarVector3d takes real howMuch, real radians returns nothing
//          -This method moves the offset of the point by the amount provided towards the angle
//          provided around the sphere. Use this if you care about the distance the point moves

//          -This method spins the offset of the point around the X and Z axis towards the angle
//          provided. Use this to give a smooth movement around the circle.

//**************************************************************************************************************************
struct circle
real x
real y
real z
real xyangle
real zangle

private real xBase

static method create takes real x, real y,real z, real radius returns thistype
local thistype this=thistype.allocate()
set .x=x
set .y=y
set .z=z
set .xyangle=0
set .zangle=0
set .xyspin=0
set .zspin=0
set .xBase=0
return this
endmethod

method operator baseX= takes real radians returns nothing
endmethod

method operator offsetZ takes nothing returns real
endmethod

method operator offsetX takes nothing returns real
endmethod

method operator offsetY takes nothing returns real
endmethod

endmethod

method polarVector2d takes real howMuch, boolean clockwise returns nothing
if clockwise==false then
set .xyangle=.xyangle+a
else
set .xyangle=.xyangle-a
endif
set .xyspin=.xyspin+a
endmethod

method polarVector3d takes real howMuch, real radians returns nothing
set .xyangle=.xyangle+a
set .zangle=.zangle+b
set .xyspin=.xyspin+a
set .zspin=.zspin+b
endmethod

endmethod

endstruct
endlibrary``````

Graphical explanations of how to use it coming soon. Enjoy!

#### Attachments

• 59.4 KB Views: 307

#### Nestharus

##### o-o
You know, it'd be cooler if you had an x radius, y radius, and z radius, or you allowed for horizontal and vertical eccentricity. This upgrade this resource from supporting just circles and spheres to ellipses and ellipsoids.

Another cool thing would be to be able to base the x,y coords off of a widget or location =P.

#### Dirac

##### 22710180
Well i tried to add the Y radius before, but didn't get the math though. Ellipses would be very cool yes, but i feel i'm not skilled enought to do it yet, i'll keep working on that. (So far the only thing i can do is add the Z ellipse option that would be very easy)

#### Dirac

##### 22710180

General chit-chat
Help Users
• No one is chatting at the moment.
• jonas:
where did you go?
• The Helper:
Jefferson TX on a Paranormal Investigation of a haunted bed and breakfast - I got some friends that are paranormal investigators and they have an RV and do YouTubes
+1
• The Helper:
It was a lot of fun. The RV was bad ass
• jonas:
That sounds like fun!
+1
• The Helper:
it was a blast!
• The Helper:
I am going to post the Youtube of the investigation in the forums when it is ready
+1
• jonas:
cool!
• vypur85:
Sounds cool TH.
• tom_mai78101:
I was on a Legend of Zelda marathon...
• tom_mai78101:
Am still doing it now
+1
• jonas:
which one(s) are you playing?
• jonas:
I played a little bit of the switch title two weeks ago and found it quite boring
• The Helper:
just got back from San Antonio this weekend had the best Buffalo Chicken Cheesesteak sandwhich in Universal City, TX - place was called Yous Guys freaking awesome! Hope everyone had a fantastic weekend!
+1
• The Helper:
Happy Tuesday!
• The Helper:
We have been getting crazy numbers reported by the forum of people online the bots are going crazy on us I think it is AI training bots going at it at least that is what it looks like to me.
• The Helper:
Most legit traffic is tracked on multiple Analytics and we have Cloud Flare setup to block a ton of stuff but still there is large amount of bots that seem to escape detection and show up in the user list of the forum. I have been watching this bullshit for a year and still cannot figure it out it is drving me crazy lol.
+1
• Ghan:
Beep boop
+1
• The Helper:
hears robot sounds while 250 bots are on the forum lol
• The Helper:
Happy Saturday!
+1
• The Helper:
and then it was Thursday...
+2
• tom_mai78101:
And then Monday
+1
• The Helper:
I got the day off today!
+1
• tom_mai78101:
How...? (T-T)
• The Helper:
I took the day off. I work for myself so I can do that.
+1
• Varine:

### Members online

No members online now.