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.
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/PKG-INFO +1 -1
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/pyproject.toml +1 -1
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/utilslibrary/__init__.py +100 -0
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/utilslibrary.egg-info/PKG-INFO +1 -1
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/Discription.txt +0 -0
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/README.md +0 -0
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/setup.cfg +0 -0
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/utilslibrary.egg-info/SOURCES.txt +0 -0
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/utilslibrary.egg-info/dependency_links.txt +0 -0
- {utilslibrary-0.0.7 → utilslibrary-0.0.7.2}/utilslibrary.egg-info/top_level.txt +0 -0
|
@@ -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!")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|