question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CompoundGeometry.from_points with control_points=None

See original GitHub issue

Describe the bug When using CompoundGeometry.from_points with control_points=None, the class method fails.

To Reproduce

import sectionproperties.pre.sections as sections
from sectionproperties.analysis.cross_section import Section

points = [[0,0], [0,1], [1,1], [1,0], [1,0.25], [1,0.75], [2,0.75], [2,0.25] ]
facets = [[0,1], [1,2], [2,5],[5,4], [4,3], [3,0], [4,5], [5,6], [6,7], [7,4]]
holes = []

geometry = sections.CompoundGeometry.from_points(points, facets, holes)
TypeError: 'NoneType' object is not iterable

originating at here

Expected behaviour With control_points=None and material=None, I would expect Shapely representative points to be generated.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
normanrichardsoncommented, Dec 23, 2021

@connorferster The “possible scenarios” you showed, are the exact complexity issue I was beginning to see myself, by allowing control_points=None in CompoundGeometry.

My intent behind this issue, was that I feel that for the user it would be ambiguous to allow control_points=None in Geometry and not allow control_points=None in CompoundGeometry. I feel this way about the behavior of the two functions in general, what the one does the other should do. That said, fundamentally there is nothing wrong with allowing different behaviors, and I see many viable solutions here:

  1. CompoundGeometry.from_points is different from Geometry.from_points. We allow control_points=None in Geometry and document it nicely.
  2. CompoundGeometry.from_points and Geometry.from_points both don’t allow control_points=None.
  3. CompoundGeometry.from_points and Geometry.from_points both allow control_points=None.
  4. We deprecate CompoundGeometry.from_points and Geometry.from_points

I think 4 is the most difficult solution as we then have to look hard at the whole library and consider other deprecations.

I see 3 as a doable but perhaps difficult solution. I also agree with Robbie’s feelings questioning scope. I can see another issue looming: a user will put in one set of data (say facets), and different data could come out! I think this would happen in “possible scenarios” 4 (two overlapping rectangles). A facet list goes in, and all of a sudden the facet list is now modified with additional entries, etc. I think a user may find this confusing. If this is not clear, let me know and I can make an example.

I see 1 and 2 as more or less equal, easy enough to implement. 2 would mean the user would have to be 100% explicit about the control_points, while reducing convenience.

If I’m missing solutions let me know.

1reaction
connorferstercommented, Dec 22, 2021

Baaaammm! Nailed it.

Will write some new tests for CompoundGeometry.from_points() and add a new section to Advanced Geometry in the docs before submitting the PR but here is the more robust .from_points() algorithm at work:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Geometry of Molecules - Chemistry LibreTexts
Molecular geometry, also known as the molecular structure, is the three-dimensional structure or arrangement of atoms in a molecule.
Read more >
Creating Geometries, Meshes, and Material Properties
An interface for the creation of CompoundGeometry objects through the definition of points, facets, holes, and control_points. Geometries created through ...
Read more >
arcgis.geometry module | ArcGIS API for Python
The arcgis.geometry module defines useful geometry types for working with ... These fields control the interpretation of elements of the points array.
Read more >
VSEPR Theory and How to Determine the Shape of a Molecule
Ketzbook explains molecular geometry, VSEPR theory, and the 5 basic shapes of molecules with ... Intermolecular Forces and Boiling Points.
Read more >
[IR SS2] Generate H & V geometry from point elements?
Create Alignment from COGO points looks promising also, ... DTM but should not be considered as part of an alignment/ control geometry.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found