Skip to content

Commit

Permalink
Update Python examples
Browse files Browse the repository at this point in the history
  • Loading branch information
victorreijgwart committed Dec 18, 2024
1 parent e0700f1 commit 3d81e74
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions examples/python/edit/crop_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
your_map = wave.Map.load(input_map_path)

# Crop the map
center = np.array([-2.2, -1.4, 0.0])
radius = 3.0
wave.edit.crop_to_sphere(your_map, center, radius)
cropping_sphere = wave.Sphere(center=np.array([-2.2, -1.4, 0.0]), radius=3.0)
wave.edit.crop(your_map, cropping_sphere)

# Save the map
output_map_path = os.path.join(user_home, "your_map_cropped.wvmp")
Expand Down
10 changes: 4 additions & 6 deletions examples/python/edit/sum_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
your_map = wave.Map.load(input_map_path)

# Crop the map
center = np.array([-2.2, -1.4, 0.0])
radius = 3.0
wave.edit.crop_to_sphere(your_map, center, radius)
cropping_sphere = wave.Sphere(center=np.array([-2.2, -1.4, 0.0]), radius=3.0)
wave.edit.crop(your_map, cropping_sphere)

# Create a translated copy
translation = np.array([5.0, 5.0, 0.0])
rotation = wave.Rotation(w=1.0, x=0.0, y=0.0, z=0.0)
transformation = wave.Pose(rotation, translation)
transformation = wave.Pose(rotation=wave.Rotation(w=1.0, x=0.0, y=0.0, z=0.0),
translation=np.array([5.0, 5.0, 0.0]))
your_map_translated = wave.edit.transform(your_map, transformation)

# Merge them together
Expand Down
5 changes: 2 additions & 3 deletions examples/python/edit/transform_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
your_map = wave.Map.load(input_map_path)

# Define a transformation that flips the map upside down, for illustration
translation = np.array([0.0, 0.0, 0.0])
rotation = wave.Rotation(w=0.0, x=1.0, y=0.0, z=0.0)
transformation = wave.Pose(rotation, translation)
transformation = wave.Pose(rotation=wave.Rotation(w=0.0, x=1.0, y=0.0, z=0.0),
translation=np.array([0.0, 0.0, 0.0]))

# Transform the map
your_map = wave.edit.transform(your_map, transformation)
Expand Down

0 comments on commit 3d81e74

Please sign in to comment.