latest pushes

This commit is contained in:
2024-11-21 14:28:02 -05:00
parent a4b34820c4
commit a9e7257136
36 changed files with 148 additions and 669 deletions

4
.gitignore vendored
View File

@@ -1,4 +0,0 @@
publish.sh
tests
setup.py
dist

2
Package/python/publish.sh Executable file
View File

@@ -0,0 +1,2 @@
python setup.py sdist
twine upload dist/*

44
Package/python/setup.py Normal file
View File

@@ -0,0 +1,44 @@
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name="bellande_step",
version="0.3.3",
description="Robots Step",
long_description=long_description,
long_description_content_type="text/markdown",
author="RonaldsonBellande",
author_email="ronaldsonbellande@gmail.com",
packages=find_packages(where="src"),
package_dir={"": "src"},
include_package_data=True,
install_requires=[
"numpy",
],
classifiers=[
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
],
keywords=["package", "setuptools"],
python_requires=">=3.0",
extras_require={
"dev": ["pytest", "pytest-cov[all]", "mypy", "black"],
},
package_data={
'bellande_step': ['Bellande_Step'],
},
entry_points={
'console_scripts': [
'bellande_step_executable = bellande_step.bellande_step_executable:main',
'bellande_step_api = bellande_step.bellande_step_api:main',
],
},
project_urls={
"Home": "https://github.com/Robotics-Sensors/bellande_step",
"Homepage": "https://github.com/Robotics-Sensors/bellande_step",
"documentation": "https://github.com/Robotics-Sensors/bellande_step",
"repository": "https://github.com/Robotics-Sensors/bellande_step",
},
)

View File

@@ -0,0 +1,78 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
import requests
import argparse
import json
import sys
def make_bellande_step_request(node0, node1, limit, dimensions):
url = "https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step_nd"
# Convert string inputs to lists if they're strings
if isinstance(node0, str):
node0 = json.loads(node0)
if isinstance(node1, str):
node1 = json.loads(node1)
payload = {
"node0": node0,
"node1": node1,
"limit": limit,
"dimensions": dimensions,
"auth": {
"authorization_key": "bellande_web_api_opensource"
}
}
headers = {
'accept': 'application/json',
'Content-Type': 'application/json'
}
try:
response = requests.post(url, json=payload, headers=headers)
response.raise_for_status()
return response.json()
except requests.RequestException as e:
print(f"Error making request: {e}", file=sys.stderr)
sys.exit(1)
def main():
parser = argparse.ArgumentParser(description="Run Bellande Step API")
parser.add_argument("--node0", required=True, help="First coordinate as JSON-formatted list")
parser.add_argument("--node1", required=True, help="Second coordinate as JSON-formatted list")
parser.add_argument("--limit", type=int, required=True, help="Limit for the algorithm")
parser.add_argument("--dimensions", type=int, required=True, help="Number of dimensions")
args = parser.parse_args()
try:
result = make_bellande_step_request(
args.node0,
args.node1,
args.limit,
args.dimensions
)
print(json.dumps(result, indent=2))
except json.JSONDecodeError as e:
print(f"Error: Invalid JSON format in coordinates - {e}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()

View File

@@ -29,24 +29,24 @@ def get_executable_path():
return os.path.join(application_path, 'Bellande_Step')
def run_bellande_step(coord1, coord2, limit, dimensions):
def run_bellande_step(node0, node1, limit, dimensions):
executable_path = get_executable_path()
passcode = "bellande_step_executable_access_key"
# Convert string representations of coordinates to actual lists
coord1_list = json.loads(coord1)
coord2_list = json.loads(coord2)
node0_list = json.loads(node0)
node1_list = json.loads(node1)
# Validate input
if len(coord1_list) != dimensions or len(coord2_list) != dimensions:
if len(node1_list) != dimensions or len(node0_list) != dimensions:
raise ValueError(f"Coordinates must have {dimensions} dimensions")
# Prepare the command
command = [
executable_path,
passcode,
json.dumps(coord1_list),
json.dumps(coord2_list),
json.dumps(node0_list),
json.dumps(node1_list),
str(limit),
str(dimensions)
]
@@ -54,23 +54,23 @@ def run_bellande_step(coord1, coord2, limit, dimensions):
# Run the command
try:
result = subprocess.run(command, check=True, capture_output=True, text=True)
print("Output:", result.stdout)
print(result.stdout)
except subprocess.CalledProcessError as e:
print("Error occurred:", e)
print("Error output:", e.stderr)
def main():
parser = argparse.ArgumentParser(description="Run Bellande Step executable")
parser.add_argument("coord1", help="First coordinate as a JSON-formatted list")
parser.add_argument("coord2", help="Second coordinate as a JSON-formatted list")
parser.add_argument("limit", type=int, help="Limit for the algorithm")
parser.add_argument("dimensions", type=int, help="Number of dimensions")
parser = argparse.ArgumentParser(description="Run Bellande Step Executable")
parser.add_argument("--node0", help="First coordinate as a JSON-formatted list")
parser.add_argument("--node1", help="Second coordinate as a JSON-formatted list")
parser.add_argument("--limit", type=int, help="Limit for the algorithm")
parser.add_argument("--dimensions", type=int, help="Number of dimensions")
args = parser.parse_args()
run_bellande_step(
args.coord1,
args.coord2,
args.node0,
args.node1,
args.limit,
args.dimensions
)

View File

@@ -186,7 +186,7 @@ You want to compute the next step from `node0` towards `node1` while limiting th
```python
# Define Import
from bellande_step.bellande_step_2d import bellande_step_2d, Node2D
from bellande_step.bellande_step_2d import bellande_step_2d
# Define the nodes
node0 = Node2D(0, 0)
@@ -209,7 +209,7 @@ You want to compute the next step from `node0` towards `node1` while limiting th
```python
# Define Import
from bellande_step.bellande_step_3d import bellande_step_3d, Node3D
from bellande_step.bellande_step_3d import bellande_step_3d
# Define the nodes
node0 = Node3D(0, 0, 0)

View File

@@ -16,6 +16,6 @@
url: https://bellande-robotics-sensors-research-innovation-center.org
endpoint_path:
bellande_step: /api/Bellande_Step/bellande_step_nd
bellande_step: /api/Bellande_Step/bellande_step
Bellande_Framework_Access_Key: bellande_web_api_opensource

View File

@@ -16,6 +16,6 @@
url: tcp://bellande-robotics-sensors-research-innovation-center.org
endpoint_path:
bellande_step: /api/Bellande_Step/bellande_step_nd
bellande_step: /api/Bellande_Step/bellande_step
Bellande_Framework_Access_Key: bellande_web_api_opensource

View File

@@ -16,6 +16,6 @@
url: tls://bellande-robotics-sensors-research-innovation-center.org
endpoint_path:
bellande_step: /api/Bellande_Step/bellande_step_nd
bellande_step: /api/Bellande_Step/bellande_step
Bellande_Framework_Access_Key: bellande_web_api_opensource

3
git_scripts/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
fix_errors.sh
push.sh
repository_recal.sh

View File

@@ -1,5 +1,5 @@
curl -X 'POST' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step_nd' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{

View File

@@ -1,5 +1,5 @@
curl -X 'POST' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step_nd' \
'https://bellande-robotics-sensors-research-innovation-center.org/api/Bellande_Step/bellande_step' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{

View File

@@ -1,97 +0,0 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
from header_imports import *
class Node10D:
def __init__(self, x, y, z, w, v, u, t, s, r, l, parent=None):
self.coord = (x, y, z, w, v, u, t, s, r, l)
self.parent = parent
@property
def x(self):
return self.coord[0]
@property
def y(self):
return self.coord[1]
@property
def z(self):
return self.coord[2]
@property
def w(self):
return self.coord[3]
@property
def v(self):
return self.coord[4]
@property
def u(self):
return self.coord[5]
@property
def t(self):
return self.coord[6]
@property
def s(self):
return self.coord[7]
@property
def r(self):
return self.coord[8]
@property
def l(self):
return self.coord[9]
def bellande_step_10d(node0, node1, limit=75):
delta_x = node1.x - node0.x
delta_y = node1.y - node0.y
delta_z = node1.z - node0.z
delta_w = node1.w - node0.w
delta_v = node1.v - node0.v
delta_u = node1.u - node0.u
delta_t = node1.t - node0.t
delta_s = node1.s - node0.s
delta_r = node1.r - node0.r
delta_l = node1.l - node0.l
dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2 + delta_t ** 2 + delta_s ** 2 + delta_r ** 2 + delta_l ** 2)
if dist < limit:
return node1
ratio = limit / dist
step_x = node0.x + delta_x * ratio
step_y = node0.y + delta_y * ratio
step_z = node0.z + delta_z * ratio
step_w = node0.w + delta_w * ratio
step_v = node0.v + delta_v * ratio
step_u = node0.u + delta_u * ratio
step_t = node0.t + delta_t * ratio
step_s = node0.s + delta_s * ratio
step_r = node0.r + delta_r * ratio
step_l = node0.l + delta_l * ratio
return Node10D(step_x, step_y, step_z, step_w, step_v, step_u, step_t, step_s, step_r, step_l)

View File

@@ -1,46 +0,0 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
from header_imports import *
class Node2D:
def __init__(self, x, y, parent=None):
self.coord = (x, y)
self.parent = parent
@property
def x(self):
return self.coord[0]
@property
def y(self):
return self.coord[1]
def bellande_step_2d(node0, node1, limit=75):
delta_x = node1.x - node0.x
delta_y = node1.y - node0.y
dist = np.sqrt(delta_x ** 2 + delta_y ** 2)
if dist < limit:
return node1
ratio = limit / dist
step_x = node0.x + delta_x * ratio
step_y = node0.y + delta_y * ratio
return Node2D(step_x, step_y)

View File

@@ -1,54 +0,0 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
from header_imports import *
class Node3D:
def __init__(self, x, y, z, parent=None):
self.coord = (x, y, z)
self.parent = parent
@property
def x(self):
return self.coord[0]
@property
def y(self):
return self.coord[1]
@property
def z(self):
return self.coord[2]
def bellande_step_3d(node0, node1, limit=75):
delta_x = node1.x - node0.x
delta_y = node1.y - node0.y
delta_z = node1.z - node0.z
dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2)
if dist < limit:
return node1
ratio = limit / dist
step_x = node0.x + delta_x * ratio
step_y = node0.y + delta_y * ratio
step_z = node0.z + delta_z * ratio
return Node3D(step_x, step_y, step_z)

View File

@@ -1,59 +0,0 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
from header_imports import *
class Node4D:
def __init__(self, x, y, z, w, parent=None):
self.coord = (x, y, z, w)
self.parent = parent
@property
def x(self):
return self.coord[0]
@property
def y(self):
return self.coord[1]
@property
def z(self):
return self.coord[2]
@property
def w(self):
return self.coord[3]
def bellande_step_4d(node0, node1, limit=75):
delta_x = node1.x - node0.x
delta_y = node1.y - node0.y
delta_z = node1.z - node0.z
delta_w = node1.w - node0.w
dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2)
if dist < limit:
return node1
ratio = limit / dist
step_x = node0.x + delta_x * ratio
step_y = node0.y + delta_y * ratio
step_z = node0.z + delta_z * ratio
step_w = node0.w + delta_w * ratio
return Node4D(step_x, step_y, step_z, step_w)

View File

@@ -1,66 +0,0 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
from header_imports import *
class Node5D:
def __init__(self, x, y, z, w, v, parent=None):
self.coord = (x, y, z, w, v)
self.parent = parent
@property
def x(self):
return self.coord[0]
@property
def y(self):
return self.coord[1]
@property
def z(self):
return self.coord[2]
@property
def w(self):
return self.coord[3]
@property
def v(self):
return self.coord[4]
def bellande_step_5d(node0, node1, limit=75):
delta_x = node1.x - node0.x
delta_y = node1.y - node0.y
delta_z = node1.z - node0.z
delta_w = node1.w - node0.w
delta_v = node1.v - node0.v
dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2)
if dist < limit:
return node1
ratio = limit / dist
step_x = node0.x + delta_x * ratio
step_y = node0.y + delta_y * ratio
step_z = node0.z + delta_z * ratio
step_w = node0.w + delta_w * ratio
step_v = node0.v + delta_v * ratio
return Node5D(step_x, step_y, step_z, step_w, step_v)

View File

@@ -1,72 +0,0 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
from header_imports import *
class Node6D:
def __init__(self, x, y, z, w, v, u, parent=None):
self.coord = (x, y, z, w, v, u)
self.parent = parent
@property
def x(self):
return self.coord[0]
@property
def y(self):
return self.coord[1]
@property
def z(self):
return self.coord[2]
@property
def w(self):
return self.coord[3]
@property
def v(self):
return self.coord[4]
@property
def u(self):
return self.coord[5]
def bellande_step_6d(node0, node1, limit=75):
delta_x = node1.x - node0.x
delta_y = node1.y - node0.y
delta_z = node1.z - node0.z
delta_w = node1.w - node0.w
delta_v = node1.v - node0.v
delta_u = node1.u - node0.u
dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2)
if dist < limit:
return node1
ratio = limit / dist
step_x = node0.x + delta_x * ratio
step_y = node0.y + delta_y * ratio
step_z = node0.z + delta_z * ratio
step_w = node0.w + delta_w * ratio
step_v = node0.v + delta_v * ratio
step_u = node0.u + delta_u * ratio
return Node6D(step_x, step_y, step_z, step_w, step_v, step_u)

View File

@@ -1,77 +0,0 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
from header_imports import *
class Node7D:
def __init__(self, x, y, z, w, v, u, t, parent=None):
self.coord = (x, y, z, w, v, u, t)
self.parent = parent
@property
def x(self):
return self.coord[0]
@property
def y(self):
return self.coord[1]
@property
def z(self):
return self.coord[2]
@property
def w(self):
return self.coord[3]
@property
def v(self):
return self.coord[4]
@property
def u(self):
return self.coord[5]
@property
def t(self):
return self.coord[6]
def bellande_step_7d(node0, node1, limit=75):
delta_x = node1.x - node0.x
delta_y = node1.y - node0.y
delta_z = node1.z - node0.z
delta_w = node1.w - node0.w
delta_v = node1.v - node0.v
delta_u = node1.u - node0.u
delta_t = node1.t - node0.t
dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2 + delta_t ** 2)
if dist < limit:
return node1
ratio = limit / dist
step_x = node0.x + delta_x * ratio
step_y = node0.y + delta_y * ratio
step_z = node0.z + delta_z * ratio
step_w = node0.w + delta_w * ratio
step_v = node0.v + delta_v * ratio
step_u = node0.u + delta_u * ratio
step_t = node0.t + delta_t * ratio
return Node7D(step_x, step_y, step_z, step_w, step_v, step_u, step_t)

View File

@@ -1,83 +0,0 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
from header_imports import *
class Node8D:
def __init__(self, x, y, z, w, v, u, t, s, parent=None):
self.coord = (x, y, z, w, v, u, t, s)
self.parent = parent
@property
def x(self):
return self.coord[0]
@property
def y(self):
return self.coord[1]
@property
def z(self):
return self.coord[2]
@property
def w(self):
return self.coord[3]
@property
def v(self):
return self.coord[4]
@property
def u(self):
return self.coord[5]
@property
def t(self):
return self.coord[6]
@property
def s(self):
return self.coord[7]
def bellande_step_8d(node0, node1, limit=75):
delta_x = node1.x - node0.x
delta_y = node1.y - node0.y
delta_z = node1.z - node0.z
delta_w = node1.w - node0.w
delta_v = node1.v - node0.v
delta_u = node1.u - node0.u
delta_t = node1.t - node0.t
delta_s = node1.s - node0.s
dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2 + delta_t ** 2 + delta_s ** 2)
if dist < limit:
return node1
ratio = limit / dist
step_x = node0.x + delta_x * ratio
step_y = node0.y + delta_y * ratio
step_z = node0.z + delta_z * ratio
step_w = node0.w + delta_w * ratio
step_v = node0.v + delta_v * ratio
step_u = node0.u + delta_u * ratio
step_t = node0.t + delta_t * ratio
step_s = node0.s + delta_s * ratio
return Node8D(step_x, step_y, step_z, step_w, step_v, step_u, step_t, step_s)

View File

@@ -1,90 +0,0 @@
# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#!/usr/bin/env python3
from header_imports import *
class Node9D:
def __init__(self, x, y, z, w, v, u, t, s, r, parent=None):
self.coord = (x, y, z, w, v, u, t, s, r)
self.parent = parent
@property
def x(self):
return self.coord[0]
@property
def y(self):
return self.coord[1]
@property
def z(self):
return self.coord[2]
@property
def w(self):
return self.coord[3]
@property
def v(self):
return self.coord[4]
@property
def u(self):
return self.coord[5]
@property
def t(self):
return self.coord[6]
@property
def s(self):
return self.coord[7]
@property
def r(self):
return self.coord[8]
def bellande_step_9d(node0, node1, limit=75):
delta_x = node1.x - node0.x
delta_y = node1.y - node0.y
delta_z = node1.z - node0.z
delta_w = node1.w - node0.w
delta_v = node1.v - node0.v
delta_u = node1.u - node0.u
delta_t = node1.t - node0.t
delta_s = node1.s - node0.s
delta_r = node1.r - node0.r
dist = np.sqrt(delta_x ** 2 + delta_y ** 2 + delta_z ** 2 + delta_w ** 2 + delta_v ** 2 + delta_u ** 2 + delta_t ** 2 + delta_s ** 2 + delta_r ** 2)
if dist < limit:
return node1
ratio = limit / dist
step_x = node0.x + delta_x * ratio
step_y = node0.y + delta_y * ratio
step_z = node0.z + delta_z * ratio
step_w = node0.w + delta_w * ratio
step_v = node0.v + delta_v * ratio
step_u = node0.u + delta_u * ratio
step_t = node0.t + delta_t * ratio
step_s = node0.s + delta_s * ratio
step_r = node0.r + delta_r * ratio
return Node9D(step_x, step_y, step_z, step_w, step_v, step_u, step_t, step_s, step_r)