Jump to content
Sign in to follow this  
Jigsor

Obtuse isosceles triangle

Recommended Posts

So I have 2 position arrays. Point a and point b. I would like to make a third point c (position array). Point c (triangle height not z coordinate) should be equidistant from point a and b but not inline with either and not to far away in height that the triangle become right or accute.

Any ideas from the position or math geniuses?

Share this post


Link to post
Share on other sites

You could use BIS_fnc_relPos for both A and B, and take the back azimuth of one of the angles and put it in the other relPos, then the point at which they meet would be C.

_ptA = [getPos A, 100, 45] call BIS_fnc_relPos;
_ptB = [getPos B, 100, 225] call BIS_fnc_relPos;

if (_ptA == _ptB) then { _ptC = _ptA; };


//both "lines" extending from A and B are 100m long, except opposite angles of eachother, their endpoints being C (maybe)

Another term I believe is the reference angle:

ApWddeB.png

Edited by JShock

Share this post


Link to post
Share on other sites

After talking with him in the PCSL (Public Community Scripters' Lounge), he wanted a trianlge to use with a function that was shared on this forum a while back regarding a "curved", flanking waypoint function. So he needed to find the apex point for that curve to get his desired result, I did not get feedback on whether or not my solution worked however.

Share this post


Link to post
Share on other sites

I just chatted to Jigsor in the scripters lounge.

He was a really nice guy and from what we talked about, he's looking for positions given by a line equidistant to A and B (so it's always perpendicular to their vector) but it could be at any point on that vector.

Plus, think of a sine wave on that vector.

He wants positions on that sine wave.

wave.png

That's what I thought (unless I got it wrong)

Speak soon in the lounge (I was there earlier but had to go off for a bit). :)

Edited by Das Attorney

Share this post


Link to post
Share on other sites

That's what I thought (unless I got it wrong)

Speak soon in the lounge (I was there earlier but had to go off for a bit). :)

This is what I thought about it:

MlNxaDA.png

Share this post


Link to post
Share on other sites

//To have an obtuse triangle where AC == BC then the angle at point C must be the obtuse ( > 90 )
//If AC == BC then point C must be perpendicular to AB from the point AB / 2
//For angle C to be > 90 degrees the distance of C from the AB line has to be less then AB / 2 

//half the distance of AB 
_midLength = ( A distance B ) / 2;
//direction of A -> B
_midDir = [ A, B ] call BIS_fnc_relativeDirTo;
//mid point of AB
_midPos = [ A, _midLength, _midDir ] call BIS_fnc_relPos;
//point C is < AB/2 ( _midLength - 1 ) away from the AB line
//and perpendicular to AB ( _midDir +or- 90 )  
_pointC = [ _midPos, _midLength - 1, _midDir + 90 ] call BIS_fnc_relPos;

Think that looks right

Share this post


Link to post
Share on other sites

//SignWave
//Where AB/2 is the pitch
//and C ( as above, always less than AB/2 ) is the frequency

_fnc_marker = {
_mrk = createMarker [ format ["%1%2", "m", random 1000], _this ];
_mrk setMarkerShape "ICON";
_mrk setMarkerType "mil_dot";
_mrk setMarkerColor "colorBlack";
_mrk setMarkerSize [ 0.5, 0.5 ];
};

_midLength = ( A distance B ) / 2;
_midDir = [ A, B ] call BIS_fnc_relativeDirTo;
_midPos = [ A, _midLength, _midDir ] call BIS_fnc_relPos;
_pointC = [ _midPos, _midLength - 1, _midDir + 90 ] call BIS_fnc_relPos;

_travelDistance = 10000; //total distance of wave
_pointFreq = 10; //10 degrees

_pitch = _midLength;
_frequency = ( _midPos distance _pointC ) / ( 180 / _pointFreq );
_endPoint = [ _midPos, _travelDistance, _midDir + 90 ] call BIS_fnc_relPos;
_distance = _midPos distance _endPoint;

_point = 0;
for "_dis" from 0 to _distance step _frequency do {
_sine = sin _point * _pitch;
//_coSine = cos _point * _pitch;
_pos = [ _midPos, _dis, _midDir - 90 ] call BIS_fnc_relPos;
_pos = [ _pos, _sine, _midDir] call BIS_fnc_relPos;
_point = _point + _pointFreq;

_pos call _fnc_marker;

if ( _point > 359 ) then {
	_point = 0;
};
};

TEST MISSION Fixed, was only adding to one axis. It should now create the wave properly perpendicular dependent on pos A & B.

See you already have something for your wave, I leave this here as an example.

Edited by Larrow

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
Sign in to follow this  

×