@@ -732,99 +732,6 @@ pg_circle_collidelistall(pgCircleObject *self, PyObject *arg)
732
732
return ret ;
733
733
}
734
734
735
- static void
736
- _pg_rotate_circle_helper (pgCircleBase * circle , double angle , double rx ,
737
- double ry )
738
- {
739
- if (angle == 0.0 || fmod (angle , 360.0 ) == 0.0 ) {
740
- return ;
741
- }
742
-
743
- double x = circle -> x - rx ;
744
- double y = circle -> y - ry ;
745
-
746
- const double angle_rad = DEG_TO_RAD (angle );
747
-
748
- double cos_theta = cos (angle_rad );
749
- double sin_theta = sin (angle_rad );
750
-
751
- circle -> x = rx + x * cos_theta - y * sin_theta ;
752
- circle -> y = ry + x * sin_theta + y * cos_theta ;
753
- }
754
-
755
- static PyObject *
756
- pg_circle_rotate (pgCircleObject * self , PyObject * const * args , Py_ssize_t nargs )
757
- {
758
- if (!nargs || nargs > 2 ) {
759
- return RAISE (PyExc_TypeError , "rotate requires 1 or 2 arguments" );
760
- }
761
-
762
- pgCircleBase * circle = & self -> circle ;
763
- double angle , rx , ry ;
764
-
765
- rx = circle -> x ;
766
- ry = circle -> y ;
767
-
768
- if (!pg_DoubleFromObj (args [0 ], & angle )) {
769
- return RAISE (PyExc_TypeError ,
770
- "Invalid angle argument, must be numeric" );
771
- }
772
-
773
- if (nargs != 2 ) {
774
- return _pg_circle_subtype_new (Py_TYPE (self ), circle );
775
- }
776
-
777
- if (!pg_TwoDoublesFromObj (args [1 ], & rx , & ry )) {
778
- return RAISE (PyExc_TypeError ,
779
- "Invalid rotation point argument, must be a sequence of "
780
- "2 numbers" );
781
- }
782
-
783
- PyObject * circle_obj = _pg_circle_subtype_new (Py_TYPE (self ), circle );
784
- if (!circle_obj ) {
785
- return NULL ;
786
- }
787
-
788
- _pg_rotate_circle_helper (& pgCircle_AsCircle (circle_obj ), angle , rx , ry );
789
-
790
- return circle_obj ;
791
- }
792
-
793
- static PyObject *
794
- pg_circle_rotate_ip (pgCircleObject * self , PyObject * const * args ,
795
- Py_ssize_t nargs )
796
- {
797
- if (!nargs || nargs > 2 ) {
798
- return RAISE (PyExc_TypeError , "rotate requires 1 or 2 arguments" );
799
- }
800
-
801
- pgCircleBase * circle = & self -> circle ;
802
- double angle , rx , ry ;
803
-
804
- rx = circle -> x ;
805
- ry = circle -> y ;
806
-
807
- if (!pg_DoubleFromObj (args [0 ], & angle )) {
808
- return RAISE (PyExc_TypeError ,
809
- "Invalid angle argument, must be numeric" );
810
- }
811
-
812
- if (nargs != 2 ) {
813
- /* just return None */
814
- Py_RETURN_NONE ;
815
- }
816
-
817
- if (!pg_TwoDoublesFromObj (args [1 ], & rx , & ry )) {
818
- return RAISE (PyExc_TypeError ,
819
- "Invalid rotation point argument, must be a sequence "
820
- "of 2 numbers" );
821
- }
822
-
823
- _pg_rotate_circle_helper (circle , angle , rx , ry );
824
-
825
- Py_RETURN_NONE ;
826
- }
827
-
828
735
static struct PyMethodDef pg_circle_methods [] = {
829
736
{"collidecircle" , (PyCFunction )pg_circle_collidecircle , METH_FASTCALL ,
830
737
NULL },
0 commit comments