Skip to content

Commit

Permalink
import cubic spline 2d class
Browse files Browse the repository at this point in the history
  • Loading branch information
ShisatoYano committed Aug 20, 2024
1 parent 764dfe7 commit 501580b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/course/cubic_spline_course/cubic_spline_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ class CubicSpline2D:
def __init__(self, x_points, y_points):
print(x_points)
print(y_points)

def _calculate_distance_from_start(self, x_points, y_points):
pass
39 changes: 39 additions & 0 deletions src/simulations/course/cubic_spline/cubic_spline_2d_plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""
cubic_spline_2d_plot.py
Author: Shisato Yano
"""

# import path setting
import numpy as np
import sys
import matplotlib.pyplot as plt
from pathlib import Path

abs_dir_path = str(Path(__file__).absolute().parent)
relative_path = "/../../../components/"

sys.path.append(abs_dir_path + relative_path + "course/cubic_spline_course")

# import component module
from cubic_spline_2d import CubicSpline2D


# flag to show plot figure
# when executed as unit test, this flag is set as false
show_plot = True


def main():
"""
Main process function
"""

x_points = [-2.5, 0.0, 2.5, 5.0, 7.5, 3.0, -1.0]
y_points = [0.7, -6, 5, 6.5, 0.0, 5.0, -2.0]

cs_2d = CubicSpline2D(x_points, y_points)


if __name__ == "__main__":
main()

0 comments on commit 501580b

Please sign in to comment.