Jump to content
RCA3

[SOLVED] Creating ellipse with rotation

Recommended Posts

Hi, i'm using this code from @shuko for creating circles adapted for an ellipse inside an area, it works, however it's always 0º oriented. (solved)

How can I apply the area rotation onto the ellipse?

params[
	["_area", [100,100], [[]], [2]],
	["_areapos", [0,0,0], [[]], [2,3]],
	["_areadir", 360]
];

_area params [["_a", 100], ["_b", 100]];
_areapos params [["_posx", 0], ["_posy", 0]];
_areadir params [["_abdir", 360]];

private _long = _a max _b;
private _short = _a min _b;

private _abdist = _long / 2;
private _cddist = _short / 2;

private _cddir = _abdir + 90;

private _pts = [];

//Shuko
//Find circular waypoints
private _cnt = 4 + floor (random 3) + floor (_abdist / 10); // number of waypoints
private _ang = 360 / (_cnt - 1); // split circle depending on number of waypoints

for "_i" from 1 to _cnt-1 do{
	private _a = (_i * _ang);

	//0º orientation
	//private _p = [_posx - (sin _a) * _cddist, _posy - (cos _a) * _abdist, 0];

	//area dir orientation
	//http://cg.robasworld.com/parametric-equation/
	private _p = [_posx + ((_cddist * cos _a) * (cos _abdir) - (_abdist * sin _a) * (sin _abdir)), _posy - ((_cddist * cos _a) * (sin _abdir) + (_abdist * sin _a) * (cos _abdir)), 0];

	_pts pushBack _p;
};

_pts

 

Edited by RCA3
Found solution on the web.
  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×