Bisector between two 3D lines

I need to locate a CS point at the intersection of two 3D lines that are not in the same plane. The CS point needs to be rotated (around Z) half of the angle of the two 3D lines. in other words it needs to be half the angle of the bearing difference of the two .3D lines. please also refer to bisector.dgn link below, this is a bisector script but it calculates the half angle of 3d lines in any direction

/cfs-file/__key/communityserver-discussions-components-files/360/bisector.dgn

this image shows the CS rotated half the bearing angle between the two lines. looking in plan regardless of lines being 2D or 3D 

( bearing is the horizontal angle between the direction of an object and another object, or between it and that of true north.)

Parents Reply Children
  • Hi Richard,

    My approach would be to project some points down to the BaseCS XY plane then measure the angle.

    I have attached a DGN example. It could be streamlined by a function but this shows the node approach.

    Thanks
    Wayne

    DivideLines.dgn

    // Bentley GenerativeComponents Transaction File -- File structure version 1.41. (Please do not delete or change this line.)
    
    environment
    {
        GCVersion                 = '10.06.00.93';
        MSVersion                 = '10.13.01.10';
        MSProject                 = '';
        MSDesignFile              = 'C:\Users\wayne\Dropbox\GC Demos\DivideLines.dgn';
        MSMasterUnit              = {Meter, 'mm', Metric, 1.0, 1000.0};
        MSSubUnit                 = {Meter, 'mm', Metric, 1.0, 1000.0};
        MSStorageUnit             = {Meter, '', Metric, 1.0, 1000.0};
        MSUorsPerStorageUnit      = 1000.0;
    }
    
    transaction 1 stateChange 'Add baseCS'
    {
        gcModel
        {
            node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
            {
                Technique                 = 'AtDGNModelOrigin';
                DGNModelName              = 'Design Model';
                SymbolSize                = 1;
                GraphLocation             = <auto> {40.0, 40.0, 0.0, 116.37};
            }
        }
    }
    
    transaction 2 stateChange 'Add line1_EndPoint, line1_StartPoint'
    {
        gcModel
        {
            node User.Objects.line1_StartPoint Bentley.GC.NodeTypes.Point
            {
                Technique                 = 'OnPlane';
                Plane                     = User.Objects.baseCS.XYPlane;
                XTranslation              = <free> 4803.84954526119;
                YTranslation              = <free> 3043.39161735525;
                Color                     = Colors.White;
                FillColor                 = Colors.None;
                LevelName                 = 'Default';
                LineStyleName             = '0';
                LineWeight                = 0;
                Transparency              = 0.0;
                GraphLocation             = <auto> {314.0, 40.0, 0.0, 142.41};
            }
            node User.Objects.line1_EndPoint Bentley.GC.NodeTypes.Point
            {
                Technique                 = 'OnPlane';
                Plane                     = User.Objects.baseCS.XYPlane;
                XTranslation              = <free> 9803.84954526118;
                YTranslation              = <free> 3043.39161735525;
                Color                     = Colors.White;
                FillColor                 = Colors.None;
                LevelName                 = 'Default';
                LineStyleName             = '0';
                LineWeight                = 0;
                Transparency              = 0.0;
                GraphLocation             = <auto> {314.0, 222.41, 0.0, 142.41};
            }
        }
    }
    
    transaction 3 stateChange 'Add line1'
    {
        gcModel
        {
            node User.Objects.line1 Bentley.GC.NodeTypes.Line
            {
                Technique                 = 'ByPoints';
                StartPoint                = User.Objects.line1_StartPoint;
                EndPoint                  = User.Objects.line1_EndPoint;
                Color                     = Colors.White;
                FillColor                 = Colors.None;
                LevelName                 = 'Default';
                LineStyleName             = '0';
                LineWeight                = 0;
                Transparency              = 0.0;
                GraphLocation             = <auto> {588.0, 40.0, 0.0, 129.39};
            }
        }
    }
    
    transaction 4 stateChange 'Add line2_EndPoint'
    {
        gcModel
        {
            node User.Objects.line2_EndPoint Bentley.GC.NodeTypes.Point
            {
                Technique                 = 'ByCartesianCoordinates';
                CoordinateSystem          = User.Objects.baseCS;
                XTranslation              = <free> 6763.62237296726;
                YTranslation              = <free> 7244.88788706733;
                ZTranslation              = <free> 3535.53390593274;
                Color                     = Colors.White;
                FillColor                 = Colors.None;
                LevelName                 = 'Default';
                LineStyleName             = '0';
                LineWeight                = 0;
                Transparency              = 0.0;
                GraphLocation             = {318.667, 379.333, 0.0, 155.43};
            }
        }
    }
    
    transaction 5 stateChange 'Add line2'
    {
        gcModel
        {
            node User.Objects.line2 Bentley.GC.NodeTypes.Line
            {
                Technique                 = 'ByPoints';
                StartPoint                = User.Objects.line1_StartPoint;
                EndPoint                  = User.Objects.line2_EndPoint;
                Color                     = Colors.White;
                FillColor                 = Colors.None;
                LevelName                 = 'Default';
                LineStyleName             = '0';
                LineWeight                = 0;
                Transparency              = 0.0;
                GraphLocation             = {600.0, 276.0, 0.0, 129.39};
            }
        }
    }
    
    transaction 6 stateChange 'Add point1, point2, point3'
    {
        gcModel
        {
            node User.Objects.point1 Bentley.GC.NodeTypes.Point
            {
                Technique                 = 'ProjectOntoPlane';
                Plane                     = baseCS.XYPlane;
                PointToProjectOntoPlane   = line1.EndPoint;
                GraphLocation             = {1014.013, -34.627, 0.0, 129.39};
            }
            node User.Objects.point2 Bentley.GC.NodeTypes.Point
            {
                Technique                 = 'ProjectOntoPlane';
                Plane                     = baseCS.XYPlane;
                PointToProjectOntoPlane   = line2.EndPoint;
                GraphLocation             = {1006.933, 261.693, 0.0, 129.39};
            }
            node User.Objects.point3 Bentley.GC.NodeTypes.Point
            {
                Technique                 = 'ProjectOntoPlane';
                Plane                     = baseCS.XYPlane;
                PointToProjectOntoPlane   = line1.StartPoint;
                GraphLocation             = {1010.773, 105.213, 0.0, 129.39};
            }
        }
    }
    
    transaction 7 stateChange 'Add MeasureAngle'
    {
        gcModel
        {
            node User.Objects.MeasureAngle Bentley.GC.NodeTypes.FunctionCall
            {
                Technique                 = 'Default';
                Function                  = Angle;
                origin                    = point3;
                point1                    = point1;
                point2                    = point2;
                GraphLocation             = {1358.653, 26.813};
            }
        }
    }
    
    transaction 8 stateChange 'Add RoataeCS'
    {
        gcModel
        {
            node User.Objects.RoataeCS Bentley.GC.NodeTypes.CoordinateSystem
            {
                Technique                 = 'ByOriginRotationAboutCoordinateSystem';
                Origin                    = point3;
                CoordinateSystem          = baseCS;
                RotationAngle             = MeasureAngle/2;
                Axis                      = AxisOption.Z;
                GuideRadius               = 1.0;
                GraphLocation             = {1629.373, 59.453, 0.0, 155.43};
            }
        }
    }
    
    transaction 9 stateChange 'Add DividePoint'
    {
        gcModel
        {
            node User.Objects.DividePoint Bentley.GC.NodeTypes.Point
            {
                Technique                 = 'ByDirectionAndDistanceFromOrigin';
                Origin                    = point3;
                Direction                 = RoataeCS.XDirection;
                DistanceFromOrigin        = 3000;
                GraphLocation             = {1931.773, 57.533};
            }
        }
    }
    
    transaction 10 stateChange 'Change line2_EndPoint'
    {
        gcModel
        {
            node User.Objects.line2_EndPoint Bentley.GC.NodeTypes.Point
            {
                Technique                 = 'ByCartesianCoordinates';
                XTranslation              = <free> 6147.21945082577;
                YTranslation              = <free> 7711.62994488677;
            }
        }
    }
    

  • thanks for your help robert. i am finding that when the CS point runs along the curve that it sometimes rotates itself 180 degrees? this happens when the curve is straight or the curve rotates the other way? when placing elements at the CS points they can sometimes be rotated 180 degrees?

  • hi wayne, thanks for your solution. but what i am finding that the maximum angle that it can measure is 180 degrees. it cannot work out an angle greater than that? once it gets to 180 it then starts to go back towards zero? So i presume I need something that can measure angles to 360 degrees?