Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Updated minimum library version to `2.14.1` in Rhino8 GH components.
* Changed name of YAK package from `bluejay` to `compas`.
* Fixed bug in `compas.geometry.PlanarSurface`.

### Removed

Expand Down
3 changes: 1 addition & 2 deletions src/compas/geometry/surfaces/planar.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,10 @@ def point_at(self, u, v, world=True):
A point on the sphere.

"""
point = Point(u, v, 0)
point = Point(u * self.xsize, v * self.ysize, 0)
if world:
point.transform(self.transformation)
return point
# return self.frame.point + self.frame.xaxis * u + self.frame.yaxis * v

def normal_at(self, u=None, v=None, world=True):
"""Construct the normal at a point on the planar surface.
Expand Down
3 changes: 1 addition & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from compas_invocations2 import style
from compas_invocations2 import tests
from compas_invocations2 import grasshopper
from invoke import Collection
from invoke.collection import Collection
Copy link

Copilot AI Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import should use from invoke import Collection instead of the specific submodule path. This is the recommended import pattern for invoke.

Suggested change
from invoke.collection import Collection
from invoke import Collection

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my editor suggests the opposite...


ns = Collection(
docs.help,
Expand All @@ -26,7 +26,6 @@
build.build_cpython_ghuser_components,
grasshopper.yakerize,
grasshopper.publish_yak,
grasshopper.update_gh_header,
)
ns.configure(
{
Expand Down
60 changes: 60 additions & 0 deletions tests/compas/geometry/test_surfaces_plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@ def test_plane(xsize, ysize):
assert plane.frame == other.frame


@pytest.mark.parametrize(
"xsize,ysize",
[
(0, 0),
(1, 0),
(0, 1),
(1, 1),
(10, 1),
(1, 10),
(2, 3),
(3, 2),
(random(), random()),
],
)
def test_plane_size(xsize, ysize):
plane = PlanarSurface(xsize=xsize, ysize=ysize)

assert plane.point_at(1, 0) == Point(xsize, 0, 0)
assert plane.point_at(0, 1) == Point(0, ysize, 0)
assert plane.point_at(1, 1) == Point(xsize, ysize, 0)

assert plane.point_at(0.5, 0) == Point(0.5 * xsize, 0, 0)
assert plane.point_at(0, 0.5) == Point(0, 0.5 * ysize, 0)
assert plane.point_at(0.5, 0.5) == Point(0.5 * xsize, 0.5 * ysize, 0)


@pytest.mark.parametrize(
"frame",
[
Expand Down Expand Up @@ -107,3 +133,37 @@ def test_plane_data():
# =============================================================================
# Other Methods
# =============================================================================

# =============================================================================
# Conversions
# =============================================================================


@pytest.mark.parametrize(
"xsize,ysize",
[
(0, 0),
(1, 0),
(0, 1),
(1, 1),
(10, 1),
(1, 10),
(2, 3),
(3, 2),
(random(), random()),
],
)
def test_plane_conversion_to_mesh(xsize, ysize):
plane = PlanarSurface(xsize=xsize, ysize=ysize)

area = plane.xsize * plane.ysize

mesh = plane.to_mesh(1, 1)
assert mesh.number_of_vertices() == 4
assert mesh.number_of_faces() == 1
assert TOL.is_close(mesh.area(), area)

mesh = plane.to_mesh(10, 10)
assert mesh.number_of_vertices() == 121
assert mesh.number_of_faces() == 100
assert TOL.is_close(mesh.area(), area)
Loading