-
Notifications
You must be signed in to change notification settings - Fork 135
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
IfcFragmentSettings:coordinate usage? #493
Comments
@onderilkesever you are right, the coordination is on the web-ifc settings. This should be removed! |
thanks for the response @agviegas ! Can you please elaborate what do you mean with below?
|
Basically my end goal is georeferencing IFC files, and I am trying to understand if I need to transform geometries created by the library when IFC is carrying some spatial reference system information. |
@onderilkesever I mean this. When loading an IFC, web-ifc has a flag called This transformation (which is just a translation) can be found here. You can use this to coordinate models with each other, or to know the absolute location of a building |
Thanks for the answer @agviegas, I am not interested about bringing models to origin. What I understand from your comment is that COORDINATE_TO_ORIGIN is there to carry models to the origin (and if second model, to the first one if i am not wrong) that is clear. But I am not following how come this can be also used to know the absolute location of the building? Can you please explain? Thanks in advance! |
@onderilkesever Let's say we have 2 models, A and B. Both are in the absolute coordinates (10,000,000, 10,000,000, 10,000,000). If you try to load any of them with COORDINATE_TO_ORIGIN=false, you will run into nummerical stability issues. If you google "three.js shaky geometry precision" you'll see what this means. Three.js can provide solutions if you want to work far away from the origin, but I wouldn't do that, as you might find other issues down the line. If you load A with COORDINATE_TO_ORIGIN=true, our libraries will take the first vertex that it finds and move it to (0,0,0). That means that if the first vertex was (10,000,001, 10,000,001, 10,000,001), and now is (0, 0, 0), the whole model has been translated (-10,000,001, -10,000,001, -10,000,001). This translation is saved in If you load B with COORDINATE_TO_ORIGIN=true, the same will happen. But of course, B won't be aligned with A, because centering the model using the first vertex found doesn't keep the alignment among models. So if you want to aling B with A, you will need to: const transformBInvert = modelB.coordinationMatrix.clone();
transformBInvert.invert();
modelB.applyMatrix4(transformBInvert);
modelB.applyMatrix4(modelA.coordinationMatrix); This is handled automatically by the library when loading an IFC. If you want to handle this yourself, I suggest you that you keep using COORDINATE_TO_ORIGIN=true (to avoid nummerical stability when computing the geometry), but when loading a new IFC model, apply the inverse of the coordination matrix to the model, and you'll get the model in its absolute position. Then you can do whatever you want with it |
Thank you for your detailed answer here @agviegas, I understand the precision issue might occur. But at the same time, we would like to be able to position IFC models in our scene based on their georeference so that our users see the buildings in their correct place in real world. I guess this means the model can be far away from the origin naturally. I guess this could be solved if we could use spatial coordinate systems i.e a coordinate system that is more accurate on some part of the world. And i assume if model was using such coordinate information, we would need to apply set of transformations to our model geometries before displaying. That is why actually I was hoping that this |
@onderilkesever your user only knows where your model is when you show them coordinates. So you basically have 2 options:
|
Thanks for the guiding answer @agviegas ! I will try your described approach but I have a small follow up question. Now that I am focusing on option with |
Or can I simply pass |
Yes, every new model that you load, you have to do that. Apply the inverse of its own matrix, and then the matrix of the model you are using as "point of reference". Keep in mind that this should be automatically done by the library in many methods (the parameter The reason each model has its own coordination matrix is that we use the first vertex found in the model as reference point to bring it to the origin. We do it this way because any other way (e.g. using the IFC spatial structure reference) is not reliable for 100% of IFCs. This is.
You can do that, and models will be automatically aligned, but then you'll run into nummerical stability errors for models that are far away from the origin as described above. |
Thanks for the answer @agviegas, but I do not understand your last sentence. Isn't |
@onderilkesever my bad. What the |
Thanks for quick response @agviegas, I think I understood you correctly, but given there has been too many comments on this issue I would like to ask for your last confirmation just to ensure we are both at the same page.
|
That's correct @onderilkesever! |
Thanks @agviegas! I leave it up to you to close this issue as the initially reported property is still unused and can be removed. |
Removed from |
Describe the bug 📝
Hi,
the ts doc of the property
IfcFragmentSettings:coordinate
saysHowever, I cannot see any usage of that field in the codebase. I wonder is this forgotten? If not, can you please explain how does it affect the geometries created? I was hoping to set it to true, and my geometries would be in the coordinate system that is used by the IFC file.
Reproduction▶️
No response
Steps to reproduce 🔢
No response
System Info 💻
Used Package Manager 📦
npm
Error Trace/Logs 📃
No response
Validations ✅
The text was updated successfully, but these errors were encountered: