-
Notifications
You must be signed in to change notification settings - Fork 34
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
Need help computing cant geometry from IfcSegmentedReferenceCurve #128
Comments
Hi @RickBrice, thank you for your very detailed example. Sorry I have to break it down a bit to understand where the differences start. Except for some very small differences we agree on the location of Sleeper_01 (first looking at the GradientCurve). The first noticible difference is in the RefDirection values. I will check them and also take into account you valid point on having the same RefDirection for both placements (that are 1 meter apart) what does not make sense (it looks like the RefDirection could be derived from the segmented curve instead of from the calculated curve, what is of course incorrect). Thanks, I will first investigate these 2 points and come back on this ASAP. Afterwards we can go into the SegmentedReference curve |
<script
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
type="text/javascript">
</script>
@peterrdf - You said something during the IF meeting last week that I didn't understand. After listening to the recording several times the light came on. I am now able to match the published Cartesian Position data very closely. Thank you for your help The calculations that follow highlight what I was doing incorrectly, implements the calculation you suggested, and ends with some items that are problematic. Plan View - IfcCompositeCurveNo change to the calculations from earlier post Placement at u = 425 along curve, d=25.0 from start of clothoid
Profile Elevation View - IfcGradientCurveNo change to the calculations from earlier post u = 425 m along the BaseCurve (which is the IfcCompositeCurve). Because the gradient curve is flat at elevation 0.0, the Cartesian position is the same as for the composite curve
Cant - IfcSegmentedReferenceCurveCompute the placement for Sleeper_01. The linear placement is
At start of cant segment 2 (#2628), u = 400 m
At start of cant segment 3 (#2639), u = 449.999993741124 m
Assume linear transition along cant segment 2. Compute Axis, RefDirection, and Location at u = 425 m Let d = 425 - 400 = 25 m, distance from start of cant segment 2 This is where I went wrong The components of the Axis vector should not be linearly interpolated
The Axis vector is in a plane that is orthogonal to the cant adjusted gradient curve at u = 425. The angle that the Axis vector makes with the Z axis is linearly interpolated. Linearly interpolate the tilt angle
The cant causes an elevation change of 0.5 between u = 400 and u = 449.999999. The slope along the curve is The change in gradient curve elevation due to cant is The cant matrix is
This matrix has elevation as Y because of the 2.5D approach to alignments. Move Location.Y to Location.Z and call the resulting matrix [c']
The position of the Sleeper_01 is the product of [g][c']
The position for Sleeper_01 is:
Compare to the value reported at https://github.com/buildingSMART/IFC4.x-IF/tree/main/IFC-files/Linear-placement-sleepers/ACCA Sleeper_01
There is now very good argeement in the results. However, this is more to the story Item 1 The exact direction of IfcLinearPlacement.RelativePlacement.Axis is given as: The resulting placement of Sleeper_01 should match this exactly. The datum Axis from the ACCA file has Axis.X = -0.001419. Close to -0.0011076, but not exactly the same. Item 2 IfcLinearPlacement.RelativePlacement.RefDirection is not povided and therefore defaults to the tangent to the curve. The segmented reference curve defines an uphill change in elevation from 0.0 to 0.5 between 400 to 499.99999. The RefDirection vector should have a non-zero Z component. Accounting for the slope, Sleeper_01 Cartesian Position is
Item 3 I calculation the Cartesian Position of Sleeper_02, accounting for the uphill slope along the curve as discussed in Item 2, as
Item 4 The clothoid constant A = 70.7106682672674 is not used in any of the calculations. What is this value supposed to be used for? |
@RickBrice thank you for finding this. Indeed we calculated values imprecise, i.e. based on segmented curves. Whit a partly fix we find the following IfcLinearPlacement.CartesianPosition, please for no ignore the normal vectors Sleeper 01: Sleeper 02: As mentioned the normal vectors are still off, this is for sure at least partly on our side. Position and Tangent seem to be 'almost' the same as your values. The difference is slightly larger than expected rounding issues but equal enough to think we are calculating the values in the same way. So in this update we calculate for all transition curve types in horizontal alignment values exactly, we do not do this for vertical alignment and cant alignment yet (in this example no issue as wertical alignment and cant alignment have both a linear change) Will fix this and come back to the other questions. Sorry it takes some time, I try to fix the found issues in the code and this takes some time. |
Hi @RickBrice Compared to your values: Attached the mini solution generating these values. |
Hi @peterrdf I'll look more closely to determine why the determinant of my matrix is not 1.0. Regarding the normal vector being quite different, I understand this to mean the Axis vector. From the ACCA input file, the exact direction of the Axis vector is given
I expect the resulting matrix to have exactly these values. In your case, they are different. What could be the explanation for that? |
@peterrdf
The IfcAxis2PlacementLinear.Axis is given and IfcAxis2PlacementLinear.RefDirection is omitted. First, I don't think this is valid (see #125). IfcAxis2PlacementLinear.Axis is given as
By the specifications, the default IfcAxis2PlacementLinear.RefDirection is the tangent to the curve. We both compute it as
Axis and RefDirection are not orthogonal. The dot product is 0.00967, leading to the determinant to be 0.99995. The Axis you report differs from mine, which is why your get a determinant of 1.0. In my view, since the exact direction of Axis is given and it is not orthogonal to the required default RefDirection, the error is in the modeling, not the calculation of the placement. If both IfcAxis2PlacementLinear.Axis and IfcAxis2PlacementLinear.RefDirection are omitted, then I compute Axis to be
which closely matches, but not exactly, your values
We are getting closer, but many questions remain. |
The computation of cant geometry is explained with an example in #160 (comment) |
Based on our conversation during the Nov 16, 2023 IF meeting, the following are hand calculations for the Cartesian Position of Sleeper_01 listed at https://github.com/buildingSMART/IFC4.x-IF/tree/main/IFC-files/Linear-placement-sleepers/ACCA.
@peterrdf Please help me understand how to perform these calculations correctly.
The IfcLinearPlacement for Sleeper_01 is defined as
The IfcLinearPlacement.RelativePlacement.Axis vector is prescribed. IfcLinearPlacement.RelativePlacement.RefDirection is not provided and is therefore tangent to the curve (See 8.9.3.4
"If RefDirection is omitted, the direction is taken from the curve tangent at Location."
). Since IfcLinearPlacement.RelativePlacement.Location is an IfcPointByDistanceExpression with BasisCurve referencing#2617
, the IfcSegmentedReferenceCurve, the IfcLinearPlacement.RelativePlacement.RefDirection is tangent to the curve which should include a non-zero Z component because the cant segment is changing the basis curve elevation from 0.0 to 0.5 between u = 400 and u = 449.99999. These calculations and the reported example placements do not have non-zero RefDirection.Z.Plan View - IfcCompositeCurve
Compute placement at u = 425 m along the composite curve
Distance along curve$$d=425-400=25.0$$
Compute coordinate at d.
$$x=C_x + A\sqrt{\pi}(\int_{0}^{u}\cos(\pi\frac{At^2}{2|A|})dt)$$
Parametric value at end of curve$$u = \frac{25.0}{485.40647841}=0.051503226$$
Point on clothoid
$$x=C_x + A\sqrt{\pi}(\int_{0}^{u}\cos(\pi\frac{At^2}{2|A|})dt) = 400.0 + (-273.861278752584)\sqrt{\pi}(\int_{0}^{0.051503226}\sin(\pi\frac{-273.861278752584t^2}{2|-273.861278752584|})dt)=424.999956527$$
Compute tangent to curve at d=25.0 (this is the RefDirection)
Radius at end of curve$$R=\frac{A^2}{L} = \frac{(-273.861278752584)^2}{150}=500.0$$
Total sweep angle of clothoid (use negative Radius for curve to right)
$$\Delta=\frac{L}{2R}=\frac{150}{(2)(-500)}=-0.15$$
Sweep angle from start to d=25.0
$$\delta={(\frac{d}{L})}^2\Delta=({\frac{25}{150}})^2(-0.15)=-0.0041666666$$
Tangent vector
$$dx = cos(-0.004166666)=0.999991319$$
$$dy = sin(-0.004166666)=-0.00416665$$
Placement at d=25.0
Profile Elevation View - IfcGradientCurve
u = 426 m along the BaseCurve (which is the IfcCompositeCurve). Because the gradient curve is flat at elevation 0.0, the Cartesian position is the same as for the composite curve
Cant - IfcSegmentedReferenceCurve
At start of cant segment 2 (#2628), u = 400 m
At start of cant segment 3 (#2639), u = 449.999993741124 m
Assume linear transition along cant segment 2. Compute Axis, RefDirection, and Location at u = 425 m
Let d = 425 - 400 = 25 m, distance from start of cant segment 2
Repeat with similar calculations for RefDirection and Location
At this point, I don't know what to do. How are the Axis, RefDirection, and Location determined from the IfcSegmentReferenceCurve.Segments combined with the Axis, RefDirection, and Location from the IfcGradientCurve.Segments to get the resulting IfcLinearPlacement for Sleeper_01?
My best guess is shown in the following calculations, but the end result does not match those reported for the sleeper placement example.
Gradient Curve
Segmented Reference Curve, cant
My best guess is to do the following:
My calculations for Sleeper_01 placement is:
Compare to the value reported at https://github.com/buildingSMART/IFC4.x-IF/tree/main/IFC-files/Linear-placement-sleepers/ACCA
Sleeper_01
The values are similar but not exactly the same. The RefDirection.Y values have opposite signs - this is concerning.
@michelangelo-acca I am puzzled why the RefDirection for Sleeper_01 and Sleeper_02 are the same when the sleepers are 1 m apart on a curve. Also, why are the RefDirection.Z values equal to zero. The IfcLinearPlacement.RelativePlacement.RefDirection is not provided so the default is tangent to the curve, which is increasing in elevation between u = 400 and u = 499.99999.
The text was updated successfully, but these errors were encountered: