Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
GenerativeComponents
  • Product Communities
GenerativeComponents
GenerativeComponents Community Wiki Modular Multiplication On Circle
    • 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
      • Ulam Spiral From A Rectangular Spiral
      • Video Tutorials
      • Video Tutorials - Short Techniques
      • Working with Parametric cells
    • +User Projects
    • +Visualized Parametric Experimentations
    • +zed_Older Content

     
     Questions about this article, topic, or product? Click here. 

    Modular Multiplication On Circle

      Product(s): OpenBuildings Generative Components
      Version(s): 10.06.03.04
      Environment:  N\A

     

    Background

    In Modular arithmetic, we deal with a fixed quantity of integers, and whatever calculation(addition, subtraction, multiplication, division) we perform, our results are always within that fixed set of numbers.

    An intuitive example would be the 12hr clock.  If the present time is 9:00 then the time after 5hrs would be 3:00hr instead of 14:00hr. In this calculation we note that the value always lies inside 12 and here the numbers "wraps-around" after reaching the maximum set quantity(i.e 12 in this case). The maximum set quantity is called modulus. A clock would be example 12 modulus.
    We use the modular operator to find the value. In the above example, the answer is calculated by (5+9) modular 12, we get reminder 2 as the required value.

    We will apply this concept to visualize beautiful modular multiplication on a circle for a higher number of modulus. This gives us some amazing patterns.

    .

    Steps to Accomplish

    Step 1

    We take a circle and add number of equidistant points on it. The count of the total number points is the modulus. If we take 10 points on the circle the modulus will be 10. Each point denotes a number starting from zero. Basically, the number will be the index of the point.

    Step 2

    Now we choose an integer multiplier. Let's start with multiplier 2. We multiply the index of each point and calculate the corresponding modular value. Eg 2*1=2, 2mod10 is 2. So join points 1 and 2 with a line.
    Similarly, all the points are mapped with its result.

    With the help of GCScript, we can write a function in Line node to do this.

    function (Point[] pt, int multiple)
    {
        Line ln;
        for (int i = 1; i < pt.Count; ++i)
        {
            ln = new Line(this);
            if (i!=i*multiple%pt.Count)
            {
                ln.ByPoints(pt[i],pt[i*multiple%pt.Count]); 
            }
        }            
        this.Color = Random(1,255);
    }

    Step 3

    With slider, we can further change the multiplier and number of points(i.e the modulus) to get beautiful patterns. Some examples are illustrated in the below Video.

    Play this video

    Please go through the sample file https://communities.bentley.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-28/ModularMultiplicationOnCircle.gct

    • pattern
    • OpenBuildings Designer
    • GCscript
    • GenerativeComponents CONNECT Edition
    • GC
    • Share
    • History
    • More
    • Cancel
    • Anik Mal Created by Bentley Colleague Anik Mal
    • When: Fri, May 15 2020 2:01 AM
    • Anik Mal Last revision by Bentley Colleague Anik Mal
    • When: Fri, May 15 2020 2:03 AM
    • Revisions: 2
    • Comments: 0
    Recommended
    Related
    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