-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Common_Geometry_Engine: Add Distance methods for IElementsXD #1316
Common_Geometry_Engine: Add Distance methods for IElementsXD #1316
Conversation
After taking a bit of a closer look at why So can't say I have thought trough this thoroughly yet but could we add something like |
@kThorsager could you explain the issue you mention above in more detail? A solid example/snippet of where does the code break? Intuitively I believe we should be OK without adding any new interfaces. |
public static BoundingBox IBounds(this IObject element) | ||
{ | ||
if (element == null) | ||
return null; | ||
|
||
if (element is IGeometry || element is IElement) | ||
return Bounds(element as dynamic); | ||
return null; | ||
} | ||
|
||
/******************************************/ | ||
|
||
public static BoundingBox Bounds(this IGeometry element) | ||
{ | ||
if (element == null) | ||
return null; | ||
|
||
return Bounds(element as dynamic); | ||
} | ||
|
||
/******************************************/ | ||
|
||
public static BoundingBox Bounds(this IElement element) | ||
{ | ||
if (element == null) | ||
return null; | ||
|
||
return Bounds(element as dynamic); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pawelbaran The lower two methods used to be IBounds
but things like ICurve
are both IGeometry
and IElement
so that broke, which is why I added the top method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your proposal does not look good, but might be the only way to go - I would only recommend making Bounds(IGeometry)
and Bounds(IElement)
private
as they are not compliant (their name should be IBounds
).
We can flag it up and discuss in a wider group once the PR is ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it does look quite horrendous.
But a note is that I was thinking of holding of on this PR until #1319 and/or #1314 is merged since they all mess with the .csproj
.
But if we want this merged soon I could probably make it ready today, but I'm expecting that there might be a lot of dependent repos that'll need updating, which would slow things down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I would definitely not rush with that one as long as there is no legitimate urgency. @rwemay @al-fisher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the point of having IBounds(this IObject element)
? I cannot think of a case where objects would be handled not as a list of IGeometry
or a list of IElement
but as a list of both.
This also feels very wrong to explicitely provide a method for all IObject
while you are actually only covering 2 specific types internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ICurve
s are both IElement
and IGeometry
, hence a list of ICurve
s are a list of both.
This is some initial work before I realized the scope of the problem and is really not the solution I would go for.
…lementsXD-and-Migrate-Common-to-Geometry
I have tried to take a closer look at the issues with keeping the
So some options to resolve this as I see it would be:
But in general, the way things inherits in the Geometry_oM is a bit back and forth between |
Just thinking: maybe it would be a bit hardcore, but what if we ditched Then, we could ditch all interface methods working on |
I thought |
That was this one. It is meant to identify the analytical elements that have geometrical representation of certain type, so maybe it could just be replaced with Alternatively, I would opt for excluding |
I would prefer that last option myself, I don't personally feel that an Analytical Panel should be tagged as |
That is why it inherits directly from Maybe I am messing it up too much, but we could also keep |
Would not say a bar or panel or node is geometry. They have geometry, so personally would not want to go down that route of making all In my mind I still think we need both interfaces, and they have clear defined roles: IGeometry - for any obejct that is just pure geometry, nothing more nothing less As for curve/point, we would still need them to share an interface to be able to use a curve/bar interchangeably, right? So personally would not remove that implementation. Might be missing the bigger picture here, but why is it a problem? Has been working well so far? EDIT sorry, reading through @kThorsager s comments above a bit closer now. Would opt for a solution that does not drastically changes the object heirachy for this personally, unless we have to still. If it means separate engines I would prefer that over messing with the interfaces. |
Hmm, looking at the comments above I have an impression that we might need to come back to the core question if |
Yeah, agree with you. IMO, at least the methods feels a bit misplaced in the Geometry_Engine, and then the same sort of must hold true for the oM. |
@al-fisher @rwemay @IsakNaslundBh @FraserGreenroyd @pawelbaran @adecler Some general solution options are outlined further up with a graph of the object hierarchy. There is also another point being brought up by @pawelbaran on whether It would be good to get some answers so that this PR can finally get some work done on it. |
@kThorsager I still see no problem with the object hierarchy. IMO, but happy for others to chip in, I would keep those methods out of the Geometry_Engine and keep the Geometry_Engine for just simple plain geometry. If that mean finding another place for the interfaces I would rather do that then having this kind of overlap happening. Could see them sitting in the main BHoM project for example. A question back to you, what triggered than mass moving of all of those methods in the first place? I see no record of it in any of the issues, but know getting rid of Common_Engine has been discussed before. IMO a strongly question that now, given the problems seen in this PR. |
Reading this thread and trying to get my head into it.
And I agree with @IsakNaslundBh comment above, that the concept of an The Analytical_oM is surely the right location for Before we make a decision will be good to add more to the diagram above you have produced @kThorsager - to clearly map out and document the wider relationships and reasoning also. Can add to the https://github.com/BHoM/documentation/wiki/Geometry wiki pages to help explanation going forward. |
Ah thanks @kThorsager for link above 👍 Then, as above and last comments on that thread - do you want to have a stab at mapping out the relationships and diagrams further? If you share a link to your diagram above - super happy to help develop it further. With @pawelbaran and others to help review I am sure. Does that sound like a good idea to help define clear next steps? |
Yes, I'm for having an other stab at it, I was however really not expecting to need the diagram file right now and it is as such saved locally in London, where I'm not until next week... |
Perfect - would not worry about a perfect diagram now - (just take the image above and sketch over and add to will be fine we can polish later when happy)
Yep. Exactly. Diagramming out the object relationships and then annotating with their wider dependancies, functionality and responsibilities. This will help us to see at a high level what potential conflicts there might be if we want to plan any further improvements or changes. And then in fact will be good to find a home for all of these high level object diagrams on the wiki as documentation. @FraserGreenroyd good support to the API generation we have discussed for this milestone. |
https://github.com/BHoM/BHoM/wiki/Environment_oM---Geometrical - associated links here have the Environment diagrams we did, I can probably dig out the original with both disciplines from somewhere tomorrow |
First time I am seeing this so it might just be me being outside the loop on this one but I cannot see a good reason to move methods on |
Yes!! 👍 |
Figuered that this excersise migth work out better with some computation, so I created a script which mapps out the relations between objects in some given oMs like this: The component also finds which types each type is using, but am not showing that in this graph. I do however think that there might be better software's for displaying data graph parametrically than rhino, especially if we would like to place something interactive in the wiki. Is this along the line of what you wanted @al-fisher ? Branch: BHoM_Engine-DisplayoMHeirarcy (placed it in the data engine in lack of better place) |
This is cool - great stuff @kThorsager - super useful. |
The |
Issues addressed by this PR
Closes #1313
Closes #1323
Test files
Changelog
IElementsXD
IElementsXD
methods fromCommon_Engine
toGeometry_Engine
Additional comments
This messes with both
Common_Engine
andGeometry_Engine
Took some liberties to get
Bounds.cs
to work, wouldn't mind a extra check on that.Would need some help on coordination both of when to be able to merge it and checking depending repos, (not sure of how much to trust the CI) @rwemay @pawelbaran
Small file change in
Environment_Engine
as well