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
  • Here a Version using a sheared CS. 

    function (PolyLine P_track)
    {
        for (int i = 1; i < P_track.Vertices.Count-1 ; ++i)
        {
            Point dir_point = new Point(this);
            CoordinateSystem shear_cs = new CoordinateSystem(this);
            shear_cs.ByOriginPrimarySecondaryDirections(P_track.Vertices[i],P_track.Vertices[i-1],AxisOption.X,P_track.Vertices[i+1],AxisOption.Y,TransformOption.Sheared);
            double x1 = shear_cs.ShearAngle/2;
            dir_point.ByCartesianCoordinates(shear_cs,1,1,0);
            Line angle_line = new Line(this);
            angle_line.ByStartPointDirectionLength(P_track.Vertices[i],dir_point, 10);
        }
    }



  • I'm not entirely sure I understand the original question, but I interpret (partially from the initial DGN files) that you want to create a CS at each of the vertices of a line string, such that each CS has its Z axis parallel to the file's Z axis, but is rotated around its Z axis so that its X axis direction aligns with the bisected angle formed by the lines either side of that vertex.GC_XYBisectionOfVerticiesOf3DLineString.dgn

  • hi Robert, and thanks for your reply. I want to bi sect the bearings of the two lines regardless of their angle in the Z direction. I downloaded your file and when I look at it directly down in plan, your point 1 does not bisect the direction of the two lines?

    plan snap shot from your file at CS1[3]

  • 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;
            }
        }
    }
    

Reply Children