utilslibrary 0.0.7__tar.gz → 0.0.7.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: utilslibrary
3
- Version: 0.0.7
3
+ Version: 0.0.7.2
4
4
  Summary: May work on 2.4, when tested it will update!
5
5
  Requires-Python: >=2.7
6
6
  Description-Content-Type: text/plain
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "utilslibrary"
7
- version = "0.0.7"
7
+ version = "0.0.7.2"
8
8
  description = "May work on 2.4, when tested it will update!"
9
9
  requires-python = ">=2.7"
10
10
  readme = "Discription.txt"
@@ -963,6 +963,106 @@ def pi2(terms=1000):
963
963
  return 16 * arctan(1.0/5.0, terms) - 4 * arctan(1.0/239.0, terms)
964
964
 
965
965
 
966
+ def v_add(a, b):
967
+ return (a[0] + b[0], a[1] + b[1], a[2] + b[2])
968
+
969
+
970
+ def v_sub(a, b):
971
+ return (a[0] - b[0], a[1] - b[1], a[2] - b[2])
972
+
973
+
974
+ def v_mul(a, s):
975
+ return (a[0] * s, a[1] * s, a[2] * s)
976
+
977
+
978
+ def v_div(a, s):
979
+ return (a[0] / s, a[1] / s, a[2] / s)
980
+
981
+
982
+ def v_dot(a, b):
983
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
984
+
985
+
986
+ def v_cross(a, b):
987
+ return (
988
+ a[1]*b[2] - a[2]*b[1],
989
+ a[2]*b[0] - a[0]*b[2],
990
+ a[0]*b[1] - a[1]*b[0]
991
+ )
992
+
993
+
994
+ def v_length(a):
995
+ return (a[0]*a[0] + a[1]*a[1] + a[2]*a[2]) ** 0.5
996
+
997
+
998
+ def v_distance(a, b):
999
+ return v_length(v_sub(a, b))
1000
+
1001
+
1002
+ def v_normalize(a):
1003
+ l = v_length(a)
1004
+
1005
+ if l == 0:
1006
+ return (0, 0, 0)
1007
+
1008
+ return (a[0]/l, a[1]/l, a[2]/l)
1009
+
1010
+
1011
+ def v_lerp(a, b, t):
1012
+ return (
1013
+ a[0] + (b[0] - a[0]) * t,
1014
+ a[1] + (b[1] - a[1]) * t,
1015
+ a[2] + (b[2] - a[2]) * t
1016
+ )
1017
+
1018
+
1019
+ def v_neg(a):
1020
+ return (-a[0], -a[1], -a[2])
1021
+
1022
+
1023
+ def v_zero():
1024
+ return (0, 0, 0)
1025
+
1026
+ def sin(x, terms=100):
1027
+ x = float(x)
1028
+
1029
+ result = 0.0
1030
+ power = x
1031
+ fact = 1.0
1032
+ sign = 1
1033
+
1034
+ i = 1
1035
+ while i < terms * 2:
1036
+ result += sign * (power / fact)
1037
+
1038
+ power *= x * x
1039
+ fact *= (i + 1) * (i + 2)
1040
+ sign = -sign
1041
+ i += 2
1042
+
1043
+ return result
1044
+
1045
+
1046
+ def cos(x, terms=100):
1047
+ x = float(x)
1048
+
1049
+ result = 0.0
1050
+ power = 1.0
1051
+ fact = 1.0
1052
+ sign = 1
1053
+
1054
+ i = 0
1055
+ while i < terms * 2:
1056
+ result += sign * (power / fact)
1057
+
1058
+ power *= x * x
1059
+ fact *= (i + 1) * (i + 2)
1060
+ sign = -sign
1061
+ i += 2
1062
+
1063
+ return result
1064
+
1065
+
966
1066
 
967
1067
  print("utilslibrary ! do Credits() for credits!")
968
1068
  print("Made by yipr!")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: utilslibrary
3
- Version: 0.0.7
3
+ Version: 0.0.7.2
4
4
  Summary: May work on 2.4, when tested it will update!
5
5
  Requires-Python: >=2.7
6
6
  Description-Content-Type: text/plain
File without changes
File without changes