public static IfcAreaMeasure Area(this IfcPolyLoop loop, IfcDirection normal) { IfcCartesianPoint sum = new IfcCartesianPoint(0, 0, 0); IList<IfcCartesianPoint> pts = loop.Polygon; for (int i = 0; i < pts.Count - 1; i++) { sum.Add(pts[i].CrossProduct(pts[i + 1])); } IfcDirection n = normal.Normalise(); return n.DotProduct(sum)/2; }
public static IfcAreaMeasure Area(this IfcPolyLoop loop, IfcDirection normal) { IfcCartesianPoint sum = new IfcCartesianPoint(0, 0, 0); IList <IfcCartesianPoint> pts = loop.Polygon; for (int i = 0; i < pts.Count - 1; i++) { sum.Add(pts[i].CrossProduct(pts[i + 1])); } IfcDirection n = normal.Normalise(); return(n.DotProduct(sum) / 2); }
public static IfcAreaMeasure Area(this IfcPolyLoop loop, IfcDirection normal) { var sum = new XbimPoint3D(0, 0, 0); var pts = loop.Polygon; for (var i = 0; i < pts.Count - 1; i++) { sum = XbimPoint3D.Add(sum, pts[i].CrossProduct(pts[i + 1])); } var n = normal.Normalise(); return(n.DotProduct(new XbimVector3D(sum.X, sum.Y, sum.Z)) / 2); }
/// <summary> /// Sets new directions of the axes. Direction vectors are automaticaly normalized. /// </summary> /// <param name = "axis3"></param> /// <param name = "xAxisDirectionX"></param> /// <param name = "xAxisDirectionY"></param> /// <param name = "xAxisDirectionZ"></param> /// <param name = "zAxisDirectionX"></param> /// <param name = "zAxisDirectionY"></param> /// <param name = "zAxisDirectionZ"></param> public static void SetNewDirectionOf_XZ(this IfcAxis2Placement3D axis3, double xAxisDirectionX, double xAxisDirectionY, double xAxisDirectionZ, double zAxisDirectionX, double zAxisDirectionY, double zAxisDirectionZ) { IModel model = axis3.Model; IfcDirection zDirection = model.Instances.New <IfcDirection>(); zDirection.DirectionRatios[0] = zAxisDirectionX; zDirection.DirectionRatios[1] = zAxisDirectionY; zDirection.DirectionRatios[2] = zAxisDirectionZ; zDirection.Normalise(); axis3.Axis = zDirection; IfcDirection xDirection = model.Instances.New <IfcDirection>(); xDirection.DirectionRatios[0] = xAxisDirectionX; xDirection.DirectionRatios[1] = xAxisDirectionY; xDirection.DirectionRatios[2] = xAxisDirectionZ; xDirection.Normalise(); axis3.RefDirection = xDirection; }