We have analysed the formula from buildingSMART: on-line documentation:
"The circular arc is described by (see figure 1):
• R = signed Radius, if IsConvex = true, then -R, if IsConvex = false, then +R as length measure
• s0 = StartDistAlong as length measure
• z0 = StartHeight as length measure
• g0 = StartGradient as ratio measure
•
The following equations are used for the centre of the circular arc:
center (distance along) sc = s0 - R * s0 / sqrt(1 + g0^2)
center (height) zc = z0 + R / sqrt(1 + g0^2)
The following equations are used for any point along the circular arc:
at any point s1 along the HorizontalLength
height (IsConvex = TRUE) z1 = z0 + sqrt(R^2 - (s1 - sc)^2)
height (IsConvex = FALSE) z1 = z0 - sqrt(R^2 - (s1 - sc)^2)
gradient g1 = - (s1 - sc) / (z1 - zc) "
The formula for sc must be wrong because s0 is in meter while the other element (R*S0) in the formula is in m2 - or?
I hope you were looking at the documentation here (latest IFC4x1 - the final version): http://www.buildingsmart-tech.org/ifc/IFC4x1/final/html/schema/ifcgeometricconstraintresource/lexical/ifcalignment2dversegcirculararc.htm
the radius R is not signed, it is of IfcPositiveLengthMeasure
About your question:
Let A = (x0,y0)
Let v = (1,g0) (direction vector of the gradient at A)
Search C = (xc,yc) centre of circle |R| away, perpendicular to v.
Let R = |R| * v.Ortho = |R| * (g0,-1)/sqrt(1+g0^2) // the last is the length of v
if isConvex=false, R = -R // the other way
therefore (calculating for isConvex = true)
C = A+R = (x0,y0) + |R| * (g0,-1)/sqrt(1+g0^2)
split for coordinates
xc = x0 + R * g0 /sqrt(1+g0^2)
yc = y0 - R /sqrt(1+g0^2)
Basically, there is a typo - it should be g0 and not s0.
@jan_erik_hoel which version of the documentation have you been using and more importantly where did you get the link? Did you use google search? I have tested it with searching in Google and got a link to IfcAlignment MVD that is based on an older version of IfcAlignment which has been changed for the IFC4x1 release. I guess the old bSI tech was never updated to the current version of IfcAlignment.
The bSI tech page is currently being reworked. We have to be careful to have the correct (FINAL) documentation on the new page.
The official version has this corrected already, so there is nothing to worry about.
About the old documentation removed: bSI is currently working on this, I have notified the responsible persons. Please remain patient - in the meantime, pay close attention that the documentation URL says “IFC4x1/final”.