Skip to content

Conversation

@tomvanmele
Copy link
Member

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke lint).
  • I added new functions/classes and made them available on a second-level import, e.g. compas.datastructures.Mesh.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

@tomvanmele
Copy link
Member Author

@gonzalocasas @chenkasirer @Licini i would (review and) merge as is and add more docs and tests later. otherwise this PR will be never-ending...

@tomvanmele
Copy link
Member Author

?

@chenkasirer
Copy link
Member

@gonzalocasas @chenkasirer @Licini i would (review and) merge as is and add more docs and tests later. otherwise this PR will be never-ending...

Agree. I will review today

Copy link
Member

@chenkasirer chenkasirer left a comment

Choose a reason for hiding this comment

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

LGTM

Note: I went though the commits themselves and made my comments so maybe some of comments are not relevant cause the code changed in a later commit.

Comment on lines 166 to 176
# mean, vectors, values = pca_numpy(points)
# frame = mean, vectors[0], vectors[1]
# points = world_to_local_coordinates_numpy(frame, points)

rect1 = minimum_area_rectangle_xy(points)
# area1 = (rect1[1][0] - rect1[0][0]) * (rect1[3][1] - rect1[0][1])
# rect2 = bounding_box(points)[:4]
# area2 = (rect2[1][0] - rect2[0][0]) * (rect2[3][1] - rect2[0][1])
# rect = rect1 if area1 < area2 else rect2
# rect = [[x, y, 0.0] for x, y in rect1]
# bbox = local_to_world_coordinates_numpy(frame, rect)
Copy link
Member

Choose a reason for hiding this comment

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

Dead code?

Comment on lines +16 to +18
curve = object.__new__(NurbsCurve)
curve.__init__(*args, **kwargs)
return curve
Copy link
Member

Choose a reason for hiding this comment

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

wait can we do that? I thought that didn't work..

def __len__(self):
return 4

def __getitem__(self, key):
Copy link
Member

Choose a reason for hiding this comment

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

maybe it's worth somehow mentioning this in the main docstring, otherwise I wouldn't expect Box to be subscriptable.

Copy link
Member Author

Choose a reason for hiding this comment

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

was rather thinking of removing these accessors from most objects, only keeping them for fundamental geometries like point, vector, plane, frame, etc.

Copy link
Member

@chenkasirer chenkasirer Aug 2, 2023

Choose a reason for hiding this comment

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

even better ;)

Comment on lines +491 to +539
# @classmethod
# def from_points(cls, points):
# """Construct a box from a set of points.

# Parameters
# ----------
# points : list[:class:`~compas.geometry.Point`]
# A list of points.

# Returns
# -------
# :class:`~compas.geometry.Box`
# The resulting box.

# """

# ==========================================================================
# methods
# Transformations
# ==========================================================================

# def transform(self, transformation):
# """Transform the box.

# Parameters
# ----------
# transformation : :class:`Transformation`
# The transformation used to transform the Box.

# Returns
# -------
# None

# Examples
# --------
# >>> box = Box(Frame.worldXY(), 1.0, 2.0, 3.0)
# >>> frame = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15])
# >>> T = Transformation.from_frame(frame)
# >>> box.transform(T)

# """
# self.frame.transform(transformation)
# # Always local scaling, non-uniform scaling based on frame not yet considered.
# Sc, _, _, _, _ = transformation.decomposed()
# scalex = Sc[0, 0]
# scaley = Sc[1, 1]
# scalez = Sc[2, 2]
# self.xsize *= scalex
# self.ysize *= scaley
# self.zsize *= scalez
Copy link
Member

Choose a reason for hiding this comment

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

dead code?

Comment on lines 61 to 84
@property
def data(self):
raise NotImplementedError

@data.setter
def data(self, data):
raise NotImplementedError

@classmethod
def from_data(cls, data):
"""Construct a shape from its data representation.
Parameters
----------
data : dict
The data dictionary.
Returns
-------
:class:`~compas.geometry.Shape`
The constructed shape.
"""
return cls(**data)
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this a redefinition of the Data interface?

Comment on lines +599 to +614
# def patch(self, u, v, du=1, dv=1):
# """Construct a NURBS surface patch from the surface at the given UV parameters.

# Parameters
# ----------
# u : float
# v : float
# du : int, optional
# dv : int, optional

# Returns
# -------
# :class:`~compas.geometry.NurbsSurface`

# """
# raise NotImplementedError
Copy link
Member

Choose a reason for hiding this comment

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

remove?


center, radius = bestfit_sphere_numpy(points)
return cls(radius, frame=Frame(center, [1, 0, 0], [0, 1, 0]))

Copy link
Member

Choose a reason for hiding this comment

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

maybe add a from_sphere()?

Copy link
Member Author

Choose a reason for hiding this comment

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

it is rather the other way around. the surfaces form the underlying geometry of shapes. so the idea would be to redefine the shapes such that they use an underlying surface geometry or geometries to define the shape. a bit like how breps work...

Comment on lines 479 to 490
# T[0, 0] = 1
# T[1, 1] = 1
# T[2, 2] = 1
# T[3, 3] = 1

# T[0, 3] = 0
# T[1, 3] = 0
# T[2, 3] = 0

# T[3, 0] = 0
# T[3, 1] = 0
# T[3, 2] = 0
Copy link
Member

Choose a reason for hiding this comment

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

remove?

"""
circle = Circle.from_three_points(a, b, c)
return cls(circle.radius, frame=circle.frame)

Copy link
Member

Choose a reason for hiding this comment

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

maybe add from_cylinder?

Comment on lines 149 to 190
# def normal_at(self, u):
# """Compute the normal at a point on the surface at the given parameters.

# Parameters
# ----------
# u : float
# The first parameter.

# Returns
# -------
# :class:`compas.geometry.Vector`
# The normal at the given parameters.

# """
# u = u * 2 * pi
# x = self.radius * cos(u)
# y = self.radius * sin(u)
# z = 0
# return self.frame.xaxis * x + self.frame.yaxis * y + self.frame.zaxis * z

# def frame_at(self, u, v):
# """Compute the frame at a point on the surface at the given parameters.

# Parameters
# ----------
# u : float
# The first parameter.
# v : float
# The second parameter.

# Returns
# -------
# :class:`compas.geometry.Frame`
# The frame at the given parameters.

# """
# u = u * 2 * pi
# point = self.point_at(u, v)
# zaxis = self.normal_at(u)
# yaxis = self.frame.zaxis
# xaxis = yaxis.cross(zaxis)
# return Frame(point, xaxis, yaxis)
Copy link
Member

Choose a reason for hiding this comment

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

?

@tomvanmele tomvanmele merged commit 79b5fa1 into main Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants