Java Reference
In-Depth Information
h.22 normalIZatInG mouse anGle to ranGe from 0
to 2pI
//Being used to regulate the angle and make it range from 0 to 2*PAI
private float RegulateAngle(float componentangle, float delta)
{
componentangle = componentangle+delta;
if (componentangle<0.0f) componentangle=componentangle + 2.0f*PAI;
if (componentangle>=2.0f*PAI) componentangle=componentangle - 2.0f*PAI;
return componentangle; //[0, 2*PAI)
}
h.23 lImItInG knob anGle to WIthIn a specIfIc ranGe
//Limiting the angle in the rangle between the minimum and maximum
private float LimitAngle(float delta, float componentangle, float circleposi[])
{
if ((componentangle+delta)<=circleposi[0]||(componentangle+delta)>=circleposi[circleposi.length-
1])
{
//Not allowed to exceed the scope
componentangle = RegulateAngle(componentangle, delta);
}
return componentangle;
}
h.24 lImItInG clIp anGle to WIthIn a specIfIc ranGe
//Limiting the angle in the rangle between the minimum and maximum
private float LimitConnAngle(float delta, float componentangle, float circleposi[])
{
if ((componentangle+delta)<=circleposi[0]&&(componentangle+delta)
>=circleposi[circleposi.length-1])
{
//Not allowed to exceed the scope
componentangle = RegulateAngle(componentangle, delta);
}
return componentangle;
}
Search WWH ::




Custom Search