-remove Vector2.atan2() replaced by Vector2.angle(), fixes #2260

This commit is contained in:
Juan Linietsky 2015-11-19 10:41:20 -03:00
parent 36d620c633
commit d3eb9e8c54
12 changed files with 16 additions and 16 deletions

View File

@ -29,7 +29,7 @@
#include "math_2d.h"
real_t Vector2::atan2() const {
real_t Vector2::angle() const {
return Math::atan2(x,y);
}
@ -165,7 +165,7 @@ Vector2 Vector2::floor() const {
Vector2 Vector2::rotated(float p_by) const {
Vector2 v;
v.set_rotation(atan2()+p_by);
v.set_rotation(angle()+p_by);
v*=length();
return v;
}

View File

@ -133,7 +133,7 @@ struct Vector2 {
bool operator<(const Vector2& p_vec2) const { return (x==p_vec2.x)?(y<p_vec2.y):(x<p_vec2.x); }
bool operator<=(const Vector2& p_vec2) const { return (x==p_vec2.x)?(y<=p_vec2.y):(x<=p_vec2.x); }
real_t atan2() const;
real_t angle() const;
void set_rotation(float p_radians) {

View File

@ -333,7 +333,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM1R(Vector2,dot);
VCALL_LOCALMEM1R(Vector2,slide);
VCALL_LOCALMEM1R(Vector2,reflect);
VCALL_LOCALMEM0R(Vector2,atan2);
VCALL_LOCALMEM0R(Vector2,angle);
// VCALL_LOCALMEM1R(Vector2,cross);
VCALL_LOCALMEM0R(Rect2,get_area);
@ -1297,7 +1297,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(VECTOR2,VECTOR2,Vector2,normalized,varray());
ADDFUNC0(VECTOR2,REAL,Vector2,length,varray());
ADDFUNC0(VECTOR2,REAL,Vector2,atan2,varray());
ADDFUNC0(VECTOR2,REAL,Vector2,angle,varray());
ADDFUNC0(VECTOR2,REAL,Vector2,length_squared,varray());
ADDFUNC1(VECTOR2,REAL,Vector2,distance_to,VECTOR2,"to",varray());
ADDFUNC1(VECTOR2,REAL,Vector2,distance_squared_to,VECTOR2,"to",varray());

View File

@ -197,9 +197,9 @@ void EditorExportPlatformWindows::_get_property_list( List<PropertyInfo> *p_list
}
Error EditorExportPlatformWindows::export_project(const String& p_path, bool p_debug, bool p_dumb,bool p_remote_debug) {
Error EditorExportPlatformWindows::export_project(const String& p_path, bool p_debug, int p_flags) {
Error err = EditorExportPlatformPC::export_project(p_path, p_debug, p_dumb, p_remote_debug);
Error err = EditorExportPlatformPC::export_project(p_path, p_debug, p_flags);
if(err != OK)
{
return err;

View File

@ -29,7 +29,7 @@ protected:
void _get_property_list( List<PropertyInfo> *p_list) const;
public:
Error export_project(const String& p_path, bool p_debug, bool p_dumb=false, bool p_remote_debug=false);
Error export_project(const String& p_path, bool p_debug,int p_flags=0);
EditorExportPlatformWindows();
};

View File

@ -354,7 +354,7 @@ void Node2D::look_at(const Vector2& p_pos) {
float Node2D::get_angle_to(const Vector2& p_pos) const {
return (get_global_transform().affine_inverse().xform(p_pos)).atan2();
return (get_global_transform().affine_inverse().xform(p_pos)).angle();
}
void Node2D::_bind_methods() {

View File

@ -118,7 +118,7 @@ void PathFollow2D::_update_transform() {
pos+=n*h_offset;
pos+=t*v_offset;
set_rot(t.atan2());
set_rot(t.angle());
} else {

View File

@ -131,7 +131,7 @@ void RayCast2D::_notification(int p_what) {
if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
break;
Matrix32 xf;
xf.rotate(cast_to.atan2());
xf.rotate(cast_to.angle());
xf.translate(Vector2(0,cast_to.length()));
//Vector2 tip = Vector2(0,s->get_length());

View File

@ -442,7 +442,7 @@ void Body2DSW::integrate_forces(real_t p_step) {
//compute motion, angular and etc. velocities from prev transform
linear_velocity = (new_transform.elements[2] - get_transform().elements[2])/p_step;
real_t rot = new_transform.affine_inverse().basis_xform(get_transform().elements[1]).atan2();
real_t rot = new_transform.affine_inverse().basis_xform(get_transform().elements[1]).angle();
angular_velocity = rot / p_step;
motion = new_transform.elements[2] - get_transform().elements[2];

View File

@ -1814,8 +1814,8 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
for(int i=0;i<portal_points.size()-1;i++) {
float a = portal_points[i].atan2();
float b = portal_points[i+1].atan2();
float a = portal_points[i].angle();
float b = portal_points[i+1].angle();
if (a>b) {
SWAP( portal_points[i], portal_points[i+1] );

View File

@ -1488,7 +1488,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
Matrix32 rot;
rot.elements[1] = (dfrom - center).normalized();
rot.elements[0] = rot.elements[1].tangent();
node->set_rot(snap_angle(rot.xform_inv(dto-center).atan2(), node->get_rot()));
node->set_rot(snap_angle(rot.xform_inv(dto-center).angle(), node->get_rot()));
display_rotate_to = dto;
display_rotate_from = center;
viewport->update();

View File

@ -745,7 +745,7 @@ static float _find_closest_angle_to_half_pi_arc(const Vector3& p_from, const Vec
}
//min_p = p_arc_xform.affine_inverse().xform(min_p);
float a = Vector2(min_p.x,-min_p.z).atan2();
float a = Vector2(min_p.x,-min_p.z).angle();
return a*180.0/Math_PI;
}