Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
GenerativeComponents
  • Product Communities
GenerativeComponents
GenerativeComponents Community Wiki Triangle Functions
    • Sign In
    • +An Overview of GenerativeComponents
    • +Addin Content
    • +Bentley BIM Modeler Accreditation – Program Overview
    • +C# Sample Solution and other Add-ins
    • +GenerativeComponents Solutions
    • +Learn GenerativeComponents
    • +Reference Material
    • Support for GenerativeComponents
    • -Tutorials
      • 3D array copy surface
      • Add RFA data as BuildingContent to ABD with GC Extension
      • BSplineSurface.LoftCurve is throwing an error when trying to add get the curves from cell
      • Cell Feature
      • Create a Set of Random Points
      • Creation of Global function from Custom function
      • Creation of Parabolic curve
      • Error while creating GNT
      • Free Form Roof Example
      • GC Excel Feature
      • GenerativeComponents Essentials Course
      • Get Corner points of a Solid
      • How To Create Surface From Lines & Curves
      • How to Export GC elements
      • How to get concrete sections in the cross-section dialog in Generative Components
      • Landscape Bridge Example
      • +LawCurve
      • List Of Points With A Loop Example
      • Mesh feature 3d print
      • Modular Multiplication On Circle
      • +Operation Node
      • +Optimization with the Optimizer node type
      • Palm Tree Modeler
      • Point By Function Example
      • Points On Curve
      • Prime Number Pattern
      • Selection of Points
      • Selection of points based on Query Expressions
      • Selection of points based on range of indices
      • Set a New Property Value to a Set of Selected Nodes
      • Simple Bridge Example
      • Simple Equations To Describe Form Example
      • Simple Free Form Roof Example
      • Sin Tower
      • Skeleton
      • Sunflower Seed Pattern Modelling
      • Surface Division Basic Steps
      • Surface from Rails and Swept Sections
      • The use of Packager in Generative Components
      • -Tools and Techniques
        • + 2D Convex Hull Using A Jarvis March
        • Cycloid Curve using GCScript Programming
        • Grid Field
        • Hexagon
        • Planar Panels between two arcs of unequal sweep angle
        • Sunpath Based On .xls Tabulated Data
        • Template for Techniques
        • Triangle Functions
        • User Created Genetic Algorithm
        • Walker On A Surface
      • Ulam Spiral From A Rectangular Spiral
      • Video Tutorials
      • Video Tutorials - Short Techniques
      • Working with Parametric cells
    • +User Projects
    • +Visualized Parametric Experimentations
    • +zed_Older Content

    You are currently reviewing an older revision of this page.

    • History View current version

    Some triangle functions

    Untitled Page

    feature User.Objects.VectorAngle Bentley.GC.Features.GraphFunction
    {
        Definition = 
        function (direction1, direction2)
        {   
            double c = DotProduct(direction1,direction2);
                   c = Acos(c);
            return c;
        };
        SymbolXY = {795, 610};
    }


    In trigonometry, the law of sines (also known as the sine law, sine formula, or sine rule) is an equation relating the lengths of the sides of an arbitrarytriangle to the sines of its angles. According to the law,


     \frac{a}{\sin A} \,=\, \frac{b}{\sin B} \,=\, \frac{c}{\sin C},
    so given: side a = 20, side c = 24, and angle C = 40° Using the law of sines, we conclude that
    \frac{\sin A}{20} = \frac{\sin 40^\circ}{24}.
     A = \arcsin\left( \frac{20\sin 40^\circ}{24} \right) \cong 32.39^\circ.
     

    feature User.Objects.SineRule Bentley.GC.Features.GraphFunction
    {
        Definition = 
        function (  //double a,
                    //double b,
                    double c,
                    //double A,
                    double B,
                    double C)
        {
        // this is an 80 char long line 34567890//34567890//34567890
            // This function returns the length of side 'b' 
            // when given the length of side 'c' and the angles 
            // at 'C' and 'B'. See wikipedia for diagrams.
            // http://en.wikipedia.org/wiki/Law_of_sines
            //   a       b       c
            // ————— = ————— = —————
            // sin A   sin B   sin C
            //
            //          C 
            //          ^
            //         / \
            //        /   \
            //      b/     \a
            //      /       \
            //     /         \
            //    /           \
            //  A/_____________\B
            //          c
            // Given the length of c and the angles at C and B 
            // this function returns the length of side b
                                                                                    
            double b = (c/Sin(C))*Sin(B);
            return b;
        };
        SymbolXY    = {970, 490};
        Description = "Returns the length of side 'b' when given the length of side 'c' and the angles at 'C' and 'B'.";
    }
    feature User.Objects.RemainingInternalAngleOfTriangle Bentley.GC.Features.GraphFunction
    {
            Definition = 
            function (double A, double B)
            {
            // this is an 80 char long line 34567890//34567890//34567890
                /* This function returns the third internal angle in a  
                    * triangle. 
                    * The sum of the internal angles of a triangle is
                    * always 180, so the difference between the sum of the
                    * first two and 180 gives the third.
                    * http://bit.ly/fAAceY - diagram
                    * This can be proven quite elegantly by tearing the  
                    * corners off a paper triangle and rearanging them to 
                    * make a straight line.
                    * http://bit.ly/ebGEZG - diagram
                    */

                double C = 180 - (A + B);
                return C;
            };
        SymbolXY                  = {590, 480};
        Description               = "Returns the unknown angle 'C' from a triangle where angles 'A' & 'B' are known";
    }

    feature User.Objects.AngleFromLengthLengthAndAngle Bentley.GC.Features.GraphFunction
    {
            Definition = 
        function (double a_in, double b_in, double A_in)
        {
        // this is an 80 char long line 34567890//34567890//34567890
            /* Given lengths a & b and angle A this function
                * returns an array of all the lengths and angles 
                * in the triangle.
                * Idealy this would get returned as an object,
                * but as far as I  know this is beyond GCscript
                * for the moment.
                *         C 
                *         ^
                *        / \
                *       /   \
                *     b/     \a
                *     /       \
                *    /         \
                *   /           \
                * A/_____________\B
                *         c                                        
                */

                                            
            double a = a_in * 1000; //scaling is so that the value of B is less 
            double b = b_in * 1000; //than one before it gets given to ArcSine
            double A = A_in;
                                        
            double Btemp = (b*Sin(A))/a;
            double B = Asin(B);
            double C = RemainingInternalAngleOfTriangle(A, B);//180-sum of angles
            double c = (a*Sin(C))/Sin(A);
            a = a/1000;
            b = b/1000;
            c = c/1000;
                                            
            double values = { A,     B,     C,     a,     b,     c};
            string lables = {"A[1]","B[3]","C[5]","a[7]","b[9]","c[11]"};
            object results = Interleave(lables,values);
            for (int i = 0; i < values.Count; i++)
            {
                if ((values[i].Type==typeof(double))==false)                                            
                {
                    ;
                } 
            }
            if (VERBOSE)
            {
                Print(results.ToString);
            }                                        
            return results;
        };
        SymbolXY                  = {790, 485};
        Description               = "";
    }

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies