Skip to content

Instantly share code, notes, and snippets.

View radzionc's full-sized avatar

Radzion Chachura radzionc

View GitHub Profile
...
dotProduct ({ x, y }) {
return (this.x * x) + (this.y + y)
}
...
const Vector3D = (x, y, z) => create({
scaleBy (factor) {
return Vector2D(x * factor, y * factor, z * factor)
},
negate () {
return this.scaleBy(-1)
},
normalize () {
return this.scaleBy(1 / this.length)
},
public class WallGeometry : IGraphNode
{
public Line2D Basis;
public List<WallSibling> Siblings;
public List<List<Line3D>> Openings;
public double Thickness;
public double Height;
public double Elevation;
public List<IGraphNode> Childrens =>
public void InitSiblings(List<WallGeometry> possibleSiblings)
{
var filtered = possibleSiblings.Where(wall => wall != this);
Siblings = filtered.Aggregate(new List<WallSibling>(), (walls, wall) =>
{
var point = SU.RealIntersection(wall.Basis, Basis);
return point == null ? walls : walls.Concat(new List<WallSibling> { new WallSibling(point.Value, wall) }).ToList();
});
}
List<Rebar> GetHorizontalRebars(WallGeometry wall, double cover, double step);
(List<Rebar> start, List<Rebar> end) GetPLikeRebars(WallGeometry wall, double cover, double step);
List<Rebar> GetTransVerseRebars(WallGeometry wall, double cover, double stepH, double stepV, double tr1, double tr2);
List<Rebar> GetAngularRebars(Point2D startPoint, Point2D intersectionPoint, Point2D endPoint, double thickness, double cover, double height, double step, double lanc, double elevation);
// openings reinforcement
List<Rebar> GetPLikeRebars(List<Line3D> holeContour, double thickness, double cover, double step)
List<Rebar> GetILikeRebars(List<Line3D> holeContour, double thickness, double cover, double step, double lanc)
// rebars cropping
List<List<Line3D>> LinesCroppingMappingForHoles(List<List<Line3D>> rebars, List<Point3D> contour, List<List<Point3D>> holeContours, double thickness, bool croppByContour = false)
rebars
.Select((rebar, rebarIndex) => linesAfterCropping.ElementAt(rebarIndex)
.Select(lines =>
{
var shapeCode = rebar.ShapeCode;
if (shapeCode == ShapeCodes.ANGULAR || shapeCode == ShapeCodes.G_LIKE)
{
if (lines.Count == 1) return new Rebar(rebar, lines) { ShapeCode = ShapeCodes.LINE };
return new Rebar(rebar, lines);
}
public class Rebar
{
public List<Line3D> Polyline { get; set; }
public double Diameter { get; set; }
public string ShapeCode { get; set; }
public int Type { get; set; }
}
empty yet
function delay(duration) {
const promise = new Promise(resolve => {
setTimeout(() => resolve(true), duration)
})
return promise
}
function* getCost(successAction) {
try {
const { startLocation, endLocation, apiKey } = yield select()