Example #1
0
        public static string Description(this CableSection section)
        {
            if (section == null)
            {
                return("null section");
            }

            return($"Cable {section.NumberOfCables:G3} x dia {section.CableDiameter:G3} - {CheckGetMaterialName(section.Material)}");
        }
    void Draw(CableSection section)
    {
        // Get direction Vector.
        Vector3 vectorFromStartToEnd = section.end.position - section.start.position;

        // Setting the Start object to look at the end will be used for making the wind be perpendicular to the cable later.
        section.start.forward = vectorFromStartToEnd.normalized;
        // Get number of points in the cable using the distance from the start to end, and the point density
        int pointsCount = Mathf.FloorToInt(pointDensity * vectorFromStartToEnd.magnitude);

        // What point is being calculated
        int i = 0;

        while (i < pointsCount)
        {
            // This is the fraction of where we are in the cable and it accounts for arrays starting at zero.
            float pointForCalcs = (float)i / ((pointsCount - 1) > 0 ? pointsCount - 1 : 1);
            // This is what gives the cable a curve and makes the wind move the center the most.
            float effectAtPointMultiplier = Mathf.Sin(pointForCalcs * Mathf.PI);

            // Calculate the position of the current point i
            Vector3 pointPosition = vectorFromStartToEnd * pointForCalcs;
            // Calculate the sag vector for the current point i
            Vector3 sagAtPoint = sagDirection * section.sag;
            // Calculate the sway vector for the current point i

            // Calculate the postion with Sag.
            Vector3 currentPointsPosition =
                section.start.position +
                pointPosition +
                sagAtPoint * effectAtPointMultiplier;

            // Add a point to the line renderer
            line.positionCount += 1;

            // Set point
            line.SetPosition(line.positionCount - 1, currentPointsPosition);
            i++;
        }
    }
Example #3
0
        /***************************************************/

        public static string Description(this CableSection section)
        {
            return("Cable " + section.NumberOfCables + " x dia " + section.CableDiameter + " - " + CheckGetMaterialName(section.Material));
        }
Example #4
0
 public static double MassPerMetre(this CableSection section)
 {
     //TODO: Add property for kg/m as part of the cable section?
     return(section.Area * section.Material.Density);
 }
Example #5
0
 private static void SetSpecificSection(CableSection section, cSapModel model)
 {
     //no ISectionDimentions
     throw new NotImplementedException();
 }