Skip to content
Discussion options

You must be logged in to vote

Solved:
`

/// <summary>
/// Transforms a point from OCS (Object Coordinate System) to WCS (World Coordinate System)
/// </summary>
public static XYZ TransformOcsToWcs(XYZ ocsPoint, XYZ normal)
{
    // If the normal vector is already (0,0,1), no transformation is required
    if (IsNormalStandard(normal))
    {
        return ocsPoint;
    }

    // Normalize the normal vector
    var normalizedNormal = normal.Normalize();

    // Arbitrary Axis Algorithm (the method used by AutoCAD)
    XYZ arbitraryX;
    XYZ arbitraryY;

    const double threshold = 1.0 / 64.0;

    if (Math.Abs(normalizedNormal.X) < threshold && Math.Abs(normalizedNormal.Y) < threshold)
    {
        // The normal vec…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@DomCR
Comment options

@bayramakgul
Comment options

Answer selected by bayramakgul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants