Best JavaScript code snippet using stryker-parent
building_starter.js
Source:building_starter.js
1/**2 * to use this code: import Building_starter from this js file as well as the GI module3 * run Building_starter with the GI module as input along with other start node input4 * e.g.:5 * const Building_starter = require('./Building_starter.js').Building_starter6 * const module = require('gi-module')7 * const result = await Building_starter(module, start_input_1, start_input_2, ...);8 *9 * returns: a json object:10 * _ result.model -> gi model of the flowchart11 * _ result.result -> returned output of the flowchart, if the flowchart does not return any value, result.result is the model of the flowchart12 */13// Parameter: {"name":"in_model","value":"''","type":0}14// Parameter: {"name":"pcen_art_art_w","value":"0","type":1,"min":"0","max":"100","step":"1"}15// Parameter: {"name":"pcen_art_art_d","value":"0","type":1,"min":"0","max":"100","step":"1"}16// Parameter: {"name":"pcen_art_art_f","value":"0","type":1,"min":"0","max":"100","step":"1"}17// Parameter: {"name":"pcen_art_sec_w","value":"0","type":1,"min":"0","max":"100","step":"1"}18// Parameter: {"name":"pcen_art_sec_d","value":"0","type":1,"min":"0","max":"100","step":"1"}19// Parameter: {"name":"pcen_art_sec_f","value":"0","type":1,"min":"0","max":"100","step":"1"}20// Parameter: {"name":"pcen_art_loc_w","value":0,"type":1,"min":"0","max":"100","step":"1"}21// Parameter: {"name":"pcen_art_loc_d","value":0,"type":1,"min":"0","max":"100","step":"1"}22// Parameter: {"name":"pcen_art_loc_f","value":0,"type":1,"min":"0","max":"100","step":"1"}23// Parameter: {"name":"pcen_art_w","value":"100","type":1,"min":"0","max":"100","step":"1"}24// Parameter: {"name":"pcen_art_d","value":"60","type":1,"min":"0","max":"100","step":"1"}25// Parameter: {"name":"pcen_art_f","value":"80","type":1,"min":"0","max":"100","step":"1"}26// Parameter: {"name":"pcen_sec_sec_w","value":"0","type":1,"min":"0","max":"100","step":"1"}27// Parameter: {"name":"pcen_sec_sec_d","value":"0","type":1,"min":"0","max":"100","step":"1"}28// Parameter: {"name":"pcen_sec_sec_f","value":"0","type":1,"min":"0","max":"100","step":"1"}29// Parameter: {"name":"pcen_sec_loc_w","value":"0","type":1,"min":"0","max":"100","step":"1"}30// Parameter: {"name":"pcen_sec_loc_d","value":"0","type":1,"min":"0","max":"100","step":"1"}31// Parameter: {"name":"pcen_sec_loc_f","value":"0","type":1,"min":"0","max":"100","step":"1"}32// Parameter: {"name":"pcen_sec_w","value":"100","type":1,"min":"0","max":"100","step":"1"}33// Parameter: {"name":"pcen_sec_d","value":"70","type":1,"min":"0","max":"100","step":"1"}34// Parameter: {"name":"pcen_sec_f","value":"80","type":1,"min":"0","max":"100","step":"1"}35// Parameter: {"name":"pcen_loc_loc_w","value":"100","type":1,"min":"0","max":"100","step":"1"}36// Parameter: {"name":"pcen_loc_loc_d","value":"100","type":1,"min":"0","max":"100","step":"1"}37// Parameter: {"name":"pcen_loc_loc_f","value":"60","type":1,"min":"0","max":"100","step":"1"}38// Parameter: {"name":"pcen_loc_w","value":"100","type":1,"min":"0","max":"100","step":"1"}39// Parameter: {"name":"pcen_loc_d","value":"50","type":1,"min":"0","max":"100","step":"1"}40// Parameter: {"name":"pcen_loc_f","value":"60","type":1,"min":"0","max":"100","step":"1"}41// Parameter: {"name":"pcen_og_w","value":"50","type":1,"min":"0","max":"100","step":"1"}42// Parameter: {"name":"pcen_og_d","value":"50","type":1,"min":"0","max":"100","step":"1"}43// Parameter: {"name":"pcen_og_f","value":"50","type":1,"min":"0","max":"100","step":"1"}44// Parameter: {"name":"pcen_og2_w","value":100,"type":1,"min":"0","max":"100","step":"1"}45// Parameter: {"name":"pcen_og2_d","value":"30","type":1,"min":"0","max":"100","step":"1"}46// Parameter: {"name":"pcen_og2_f","value":"50","type":1,"min":"0","max":"100","step":"1"}47async function Building_starter(__modules__, in_model, pcen_art_art_w, pcen_art_art_d, pcen_art_art_f, pcen_art_sec_w, pcen_art_sec_d, pcen_art_sec_f, pcen_art_loc_w, pcen_art_loc_d, pcen_art_loc_f, pcen_art_w, pcen_art_d, pcen_art_f, pcen_sec_sec_w, pcen_sec_sec_d, pcen_sec_sec_f, pcen_sec_loc_w, pcen_sec_loc_d, pcen_sec_loc_f, pcen_sec_w, pcen_sec_d, pcen_sec_f, pcen_loc_loc_w, pcen_loc_loc_d, pcen_loc_loc_f, pcen_loc_w, pcen_loc_d, pcen_loc_f, pcen_og_w, pcen_og_d, pcen_og_f, pcen_og2_w, pcen_og2_d, pcen_og2_f) {48const __debug__ = true;49const __model__ = null;50/** * **/51const PI = Math.PI;52const XY = __modules__._constants.XY;53const YZ = __modules__._constants.YZ;54const ZX = __modules__._constants.ZX;55const YX = __modules__._constants.YX;56const ZY = __modules__._constants.ZY;57const XZ = __modules__._constants.XZ;58const isNum = __modules__._types.isNum;59const isInt = __modules__._types.isInt;60const isFlt = __modules__._types.isFlt;61const isBool = __modules__._types.isBool;62const isStr = __modules__._types.isStr;63const isList = __modules__._types.isList;64const isDict = __modules__._types.isDict;65const isVec2 = __modules__._types.isVec2;66const isVec3 = __modules__._types.isVec3;67const isCol = __modules__._types.isCol;68const isRay = __modules__._types.isRay;69const isPln = __modules__._types.isPln;70const isNaN = __modules__._types.isNaN;71const isNull = __modules__._types.isNull;72const isUndef = __modules__._types.isUndef;73const strRepl = __modules__._strs.strRepl;74const strUpp = __modules__._strs.strUpp;75const strLow = __modules__._strs.strLow;76const strTrim = __modules__._strs.strTrim;77const strTrimR = __modules__._strs.strTrimR;78const strTrimL = __modules__._strs.strTrimL;79const strSub = __modules__._strs.strSub;80const strStarts = __modules__._strs.strStarts;81const strEnds = __modules__._strs.strEnds;82const strPadL = __modules__._strs.strPadL;83const strPadR = __modules__._strs.strPadR;84const isApprox = __modules__._util.isApprox;85const isIn = __modules__._util.isIn;86const isWithin = __modules__._util.isWithin;87const min = __modules__._math.min;88const max = __modules__._math.max;89const pow = Math.pow;90const sqrt = Math.sqrt;91const exp = Math.exp;92const log = Math.log;93const round = __modules__._math.round;94const sigFig = __modules__._math.sigFig;95const ceil = Math.ceil;96const floor = Math.floor;97const abs = Math.abs;98const sin = Math.sin;99const asin = Math.asin;100const sinh = Math.sinh;101const asinh = Math.asinh;102const cos = Math.cos;103const acos = Math.acos;104const cosh = Math.cosh;105const acosh = Math.acosh;106const tan = Math.tan;107const atan = Math.atan;108const tanh = Math.tanh;109const atanh = Math.atanh;110const atan2 = Math.atan2;111const boolean = __modules__._mathjs.boolean;112const number = __modules__._mathjs.number;113const string = __modules__._mathjs.string;114const mad = __modules__._mathjs.mad;115const mean = __modules__._mathjs.mean;116const median = __modules__._mathjs.median;117const mode = __modules__._mathjs.mode;118const prod = __modules__._mathjs.prod;119const std = __modules__._mathjs.std;120const vari = __modules__._mathjs.var;121const sum = __modules__._mathjs.sum;122const hypot = __modules__._mathjs.hypot;123const norm = __modules__._mathjs.norm;124const mod = __modules__._mathjs.mod;125const square = __modules__._mathjs.square;126const cube = __modules__._mathjs.cube;127const remap = __modules__._arithmetic.remap;128const distance = __modules__._geometry.distance;129const distanceM = __modules__._geometry.distanceM;130const distanceMS = __modules__._geometry.distanceMS;131const intersect = __modules__._geometry.intersect;132const project = __modules__._geometry.project;133const range = __modules__._list.range;134const len = __modules__._list.listLen;135const listLen = __modules__._list.listLen;136const listCount = __modules__._list.listCount;137const listCopy = __modules__._list.listCopy;138const listRep = __modules__._list.listRep;139const listLast = __modules__._list.listLast;140const listGet = __modules__._list.listGet;141const listFind = __modules__._list.listFind;142const listHas = __modules__._list.listHas;143const listJoin = __modules__._list.listJoin;144const listFlat = __modules__._list.listFlat;145const listSlice = __modules__._list.listSlice;146const listCull = __modules__._list.listCull;147const listZip = __modules__._list.listZip;148const listZip2 = __modules__._list.listZip2;149const listSort = __modules__._list.listSort;150const listRev = __modules__._list.listRev;151const setMake = __modules__._set.setMake;152const setUni = __modules__._set.setUni;153const setInt = __modules__._set.setInt;154const setDif = __modules__._set.setDif;155const length = __modules__._list.length;156const shuffle = __modules__._list.shuffle;157const concat = __modules__._list.concat;158const zip = __modules__._list.zip;159const zip2 = __modules__._list.zip2;160const vecAdd = __modules__._vec.vecAdd;161const vecSub = __modules__._vec.vecSub;162const vecDiv = __modules__._vec.vecDiv;163const vecMult = __modules__._vec.vecMult;164const vecSum = __modules__._vec.vecSum;165const vecLen = __modules__._vec.vecLen;166const vecSetLen = __modules__._vec.vecSetLen;167const vecNorm = __modules__._vec.vecNorm;168const vecRev = __modules__._vec.vecRev;169const vecFromTo = __modules__._vec.vecFromTo;170const vecAng = __modules__._vec.vecAng;171const vecAng2 = __modules__._vec.vecAng2;172const vecDot = __modules__._vec.vecDot;173const vecCross = __modules__._vec.vecCross;174const vecEqual = __modules__._vec.vecEqual;175const vecLtoG = __modules__._vec.vecLtoG;176const vecGtoL = __modules__._vec.vecGtoL;177const plnMake = __modules__._plane.plnMake;178const plnCopy = __modules__._plane.plnCopy;179const plnMove = __modules__._plane.plnMove;180const plnRot = __modules__._plane.plnRot;181const plnLMove = __modules__._plane.plnLMove;182const plnLRotX = __modules__._plane.plnLRotX;183const plnLRotY = __modules__._plane.plnLRotY;184const plnLRotZ = __modules__._plane.plnLRotZ;185const rayMake = __modules__._ray.rayMake;186const rayCopy = __modules__._ray.rayCopy;187const rayMove = __modules__._ray.rayMove;188const rayRot = __modules__._ray.rayRot;189const rayLMove = __modules__._ray.rayLMove;190const rayFromPln = __modules__._ray.rayFromPln;191const rayLtoG = __modules__._ray.rayLtoG;192const rayGtoL = __modules__._ray.rayGtoL;193const colFalse = __modules__._colors.colFalse;194const colScale = __modules__._colors.colScale;195const radToDeg = __modules__._conversion.radToDeg;196const degToRad = __modules__._conversion.degToRad;197const numToStr = __modules__._conversion.numToStr;198const rand = __modules__._rand.rand;199const randInt = __modules__._rand.randInt;200const randPick = __modules__._rand.randPick;201const setattr = __modules__._model.__setAttrib__;202const getattr = __modules__._model.__getAttrib__;203async function exec_Building_starter(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){204async function exec_Building_starter_node_wz73f8oew4(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){205while (true) {206__modules__._model.__preprocess__( __params__.model);207let coll_tissue_ = await __modules__.io.Import( __params__.model, in_model_, 'gi' );208__modules__._model.__postprocess__( __params__.model);209break; }210return __params__.model;211}212async function exec_Building_starter_node_549psa6t6a_createBldg_(__params__, footprint_) {213let type_ = __modules__.attrib.Get(__params__.model, footprint_, 'type');214let bldg_parms_ = await exec_Building_starter_node_549psa6t6a_getBldgParams_(__params__, type_);215if (__params__.terminated) { return __params__.model;}216if ((bldg_parms_[pythonList(0, bldg_parms_.length)] == 0 && bldg_parms_[pythonList(1, bldg_parms_.length)] == 0) || (bldg_parms_[pythonList(2, bldg_parms_.length)] == 0)){217return [];218}219let edges_ = __modules__.query.Get(__params__.model, '_e', footprint_);220let edge_rays_ = __modules__.calc.Ray( __params__.model, edges_ );221for (let edge_ray_ of edge_rays_){222edge_ray_[pythonList(0, edge_ray_.length)] = [edge_ray_[pythonList(0, edge_ray_.length)][pythonList(0, edge_ray_[pythonList(0, edge_ray_.length)].length)], edge_ray_[pythonList(0, edge_ray_.length)][pythonList(1, edge_ray_[pythonList(0, edge_ray_.length)].length)], 0];223}224let front_ = await exec_Building_starter_node_549psa6t6a_getFront_(__params__, edges_, edge_rays_);225if (__params__.terminated) { return __params__.model;}226printFunc(__params__.console,'front', front_);227if (front_ == null){228return [];229}230let main_axis_ = await exec_Building_starter_node_549psa6t6a_mainAxis_(__params__, front_, edge_rays_);231if (__params__.terminated) { return __params__.model;}232if (main_axis_ == null){233return [];234}235let cross_axes_ = await exec_Building_starter_node_549psa6t6a_searchCrossAxes_(__params__, main_axis_, edge_rays_, 3, [0.1, Infinity, Infinity]);236if (__params__.terminated) { return __params__.model;}237if (cross_axes_ != null){238let next_ = cross_axes_[pythonList(2, cross_axes_.length)];239cross_axes_ = await exec_Building_starter_node_549psa6t6a_searchCrossAxes_(__params__, main_axis_, edge_rays_, 1, next_);240if (__params__.terminated) { return __params__.model;}241}242if (cross_axes_ != null){243let next_ = cross_axes_[pythonList(2, cross_axes_.length)];244cross_axes_ = await exec_Building_starter_node_549psa6t6a_searchCrossAxes_(__params__, main_axis_, edge_rays_, 0.2, next_);245if (__params__.terminated) { return __params__.model;}246}247if (cross_axes_ == null){248return [];249}250let bldg_dims_ = await exec_Building_starter_node_549psa6t6a_getBldgDims_(__params__, type_);251if (__params__.terminated) { return __params__.model;}252let start_ = await exec_Building_starter_node_549psa6t6a_getFrontStart_(__params__, front_, main_axis_[pythonList(0, main_axis_.length)], cross_axes_, bldg_dims_);253if (__params__.terminated) { return __params__.model;}254let mid_ = [main_axis_[pythonList(1, main_axis_.length)][pythonList(0, main_axis_[pythonList(1, main_axis_.length)].length)], main_axis_[pythonList(1, main_axis_.length)][pythonList(1, main_axis_[pythonList(1, main_axis_.length)].length)], 0];255let bldg_footprint_ = await exec_Building_starter_node_549psa6t6a_createBldgFootprint_(__params__, footprint_, start_, mid_, cross_axes_[pythonList(1, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(1, cross_axes_.length)].length)], bldg_dims_);256if (__params__.terminated) { return __params__.model;}257if (bldg_footprint_ == null){258return [];259}260__modules__.modify.Move( __params__.model, bldg_footprint_, [0, 0, 0.1] );261__modules__.attrib.Set(__params__.model, bldg_footprint_, 'type', type_ );262__modules__.attrib.Set(__params__.model, bldg_footprint_, 'class', "bldg_footprint" );263__modules__.attrib.Set(__params__.model, bldg_footprint_, 'max_floors', __modules__.attrib.Get(__params__.model, footprint_, 'max_floors') );264return [bldg_footprint_];265}266async function exec_Building_starter_node_549psa6t6a_createBldgAmen_(__params__, footprint_) {267let bldg_footprint_ = __modules__.make.Copy( __params__.model, footprint_, [0, 0, 0.05] );268__modules__.attrib.Set(__params__.model, bldg_footprint_, 'type', __modules__.attrib.Get(__params__.model, footprint_, 'type') );269__modules__.attrib.Set(__params__.model, bldg_footprint_, 'class', "bldg_footprint" );270__modules__.attrib.Set(__params__.model, bldg_footprint_, 'max_floors', __modules__.attrib.Get(__params__.model, footprint_, 'max_floors') );271return [bldg_footprint_];272}273async function exec_Building_starter_node_549psa6t6a_getFront_(__params__, edges_, edge_rays_) {274let fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "road_art");275if (len(fronts_) == 0){276fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "road_sec");277}278if (len(fronts_) == 0){279fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "road_loc");280}281if (len(fronts_) == 0){282fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "path");283}284if (len(fronts_) == 0){285fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "green");286}287if (len(fronts_) == 0){288fronts_ = [edges_[pythonList(0, edges_.length)]];289}290if (len(fronts_) > 1){291let lengths_ = __modules__.calc.Length( __params__.model, fronts_ );292fronts_ = listZip(listSort(listZip([fronts_, lengths_]), 1))[pythonList(0, listZip(listSort(listZip([fronts_, lengths_]), 1)).length)];293}294for (let edge_ray_ of edge_rays_){295edge_ray_[pythonList(0, edge_ray_.length)] = [edge_ray_[pythonList(0, edge_ray_.length)][pythonList(0, edge_ray_[pythonList(0, edge_ray_.length)].length)], edge_ray_[pythonList(0, edge_ray_.length)][pythonList(1, edge_ray_[pythonList(0, edge_ray_.length)].length)], 0];296}297let front_ = fronts_[pythonList(-1, fronts_.length)];298return front_;299}300async function exec_Building_starter_node_549psa6t6a_mainAxis_(__params__, front_, edge_rays_) {301let front_vec_ = __modules__.calc.Vector( __params__.model, front_ );302let front_cen_ = __modules__.calc.Centroid( __params__.model, front_, 'ps_average' );303front_cen_[pythonList(2, front_cen_.length)] = 0;304let vec_ = vecSetLen([-front_vec_[pythonList(1, front_vec_.length)], front_vec_[pythonList(0, front_vec_.length)], 0], 200);305let ray_ = rayLMove(rayMake(front_cen_, vec_), 0.1);306let isect_ = await exec_Building_starter_node_549psa6t6a__isect_(__params__, ray_, edge_rays_);307if (__params__.terminated) { return __params__.model;}308if (isect_ == null){309return null;310}311let depth_vec_ = vecFromTo(front_cen_, isect_[pythonList(0, isect_.length)]);312ray_ = rayMake(front_cen_, depth_vec_);313return ray_;314}315async function exec_Building_starter_node_549psa6t6a_searchCrossAxes_(__params__, main_axis_, edge_rays_, incr_, dist_min_leftright_) {316let dist_start_ = dist_min_leftright_[pythonList(0, dist_min_leftright_.length)];317let min_left_dist_ = dist_min_leftright_[pythonList(1, dist_min_leftright_.length)];318let min_right_dist_ = dist_min_leftright_[pythonList(2, dist_min_leftright_.length)];319let front_cen_ = main_axis_[pythonList(0, main_axis_.length)];320let depth_vec_ = main_axis_[pythonList(1, main_axis_.length)];321let right_vec_ = [depth_vec_[pythonList(1, depth_vec_.length)], -depth_vec_[pythonList(0, depth_vec_.length)], 0];322let max_area_ = 0;323let ray_left_ = null;324let ray_right_ = null;325let dist_end_ = vecLen(depth_vec_);326let dist_ = dist_start_;327while (dist_ < dist_end_){328let this_start_ = vecAdd(front_cen_, vecSetLen(depth_vec_, dist_));329let this_ray_left_ = rayMake(this_start_, vecSetLen(right_vec_, -100));330let this_ray_right_ = rayMake(this_start_, vecSetLen(right_vec_, 100));331let isect_left_ = await exec_Building_starter_node_549psa6t6a__isect_(__params__, this_ray_left_, edge_rays_);332if (__params__.terminated) { return __params__.model;}333let isect_right_ = await exec_Building_starter_node_549psa6t6a__isect_(__params__, this_ray_right_, edge_rays_);334if (__params__.terminated) { return __params__.model;}335if (isect_left_ == null || isect_right_ == null){336dist_ = dist_ + incr_;337continue;338}339this_ray_left_ = rayMake(this_start_, vecFromTo(this_start_, isect_left_[pythonList(0, isect_left_.length)]));340let this_left_dist_ = vecLen(this_ray_left_[pythonList(1, this_ray_left_.length)]);341if (this_left_dist_ < min_left_dist_){342min_left_dist_ = this_left_dist_;343}344else {345this_ray_left_[pythonList(1, this_ray_left_.length)] = vecSetLen(this_ray_left_[pythonList(1, this_ray_left_.length)], min_left_dist_);346}347this_ray_right_ = rayMake(this_start_, vecFromTo(this_start_, isect_right_[pythonList(0, isect_right_.length)]));348let this_right_dist_ = vecLen(this_ray_right_[pythonList(1, this_ray_right_.length)]);349if (this_right_dist_ < min_right_dist_){350min_right_dist_ = this_right_dist_;351}352else {353this_ray_right_[pythonList(1, this_ray_right_.length)] = vecSetLen(this_ray_right_[pythonList(1, this_ray_right_.length)], min_right_dist_);354}355let this_area_ = (vecLen(this_ray_left_[pythonList(1, this_ray_left_.length)]) + vecLen(this_ray_right_[pythonList(1, this_ray_right_.length)])) * dist_;356if (this_area_ > max_area_){357ray_left_ = this_ray_left_;358ray_right_ = this_ray_right_;359max_area_ = this_area_;360}361dist_ = dist_ + incr_;362}363let next_dist_start_ = dist_ - (2 * incr_);364if (next_dist_start_ < 0){365next_dist_start_ = dist_start_;366}367let next_dist_min_lr_ = [next_dist_start_, vecLen(ray_left_[pythonList(1, ray_left_.length)]), vecLen(ray_right_[pythonList(1, ray_right_.length)])];368if (ray_left_ == null || ray_right_ == null){369let chk_ = "rays are null";370}371return [ray_left_, ray_right_, next_dist_min_lr_];372}373async function exec_Building_starter_node_549psa6t6a_createRectMax_(__params__, main_axis_, cross_axes_) {374let xyz0_ = vecAdd(main_axis_[pythonList(0, main_axis_.length)], cross_axes_[pythonList(0, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(0, cross_axes_.length)].length)]);375let xyz1_ = vecAdd(main_axis_[pythonList(0, main_axis_.length)], cross_axes_[pythonList(1, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(1, cross_axes_.length)].length)]);376let xyz2_ = vecAdd(cross_axes_[pythonList(0, cross_axes_.length)][pythonList(0, cross_axes_[pythonList(0, cross_axes_.length)].length)], cross_axes_[pythonList(1, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(1, cross_axes_.length)].length)]);377let xyz3_ = vecAdd(cross_axes_[pythonList(0, cross_axes_.length)][pythonList(0, cross_axes_[pythonList(0, cross_axes_.length)].length)], cross_axes_[pythonList(0, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(0, cross_axes_.length)].length)]);378let posis_ = __modules__.make.Position( __params__.model, [xyz0_, xyz1_, xyz2_, xyz3_] );379let pline_ = __modules__.make.Polyline( __params__.model, posis_, 'close' );380return pline_;381}382async function exec_Building_starter_node_549psa6t6a_createBldgFootprint_(__params__, permis_footprint_, start_, vec_main_, vec_right_, bldg_dims_) {383let bldg_width_ = bldg_dims_[pythonList(0, bldg_dims_.length)];384let bldg_depth_ = bldg_dims_[pythonList(1, bldg_dims_.length)];385if (bldg_width_ == 0 || bldg_depth_ == 0){386return null;387}388let xyz1_ = vecAdd(start_, vecSetLen(vec_right_, bldg_width_));389let xyz2_ = vecAdd(xyz1_, vecSetLen(vec_main_, bldg_depth_));390let xyz3_ = vecAdd(xyz2_, vecSetLen(vec_right_, -bldg_width_));391let posis_ = __modules__.make.Position( __params__.model, [start_, xyz1_, xyz2_, xyz3_] );392let pgon_ = __modules__.make.Polygon( __params__.model, posis_ );393let trim_ = __modules__.poly2d.Boolean( __params__.model, pgon_, permis_footprint_, 'intersect' );394__modules__.modify.Delete( __params__.model, pgon_, 'delete_selected' );395return trim_;396}397async function exec_Building_starter_node_549psa6t6a_getPermisDims_(__params__, plot_type_) {398let plot_dims_ = __modules__.attrib.Get(__params__.model, null, 'plot_dims');399if (plot_type_ == "art_art"){400let w_ = plot_dims_["part_art_d"] - plot_dims_["sb_art_front"] - plot_dims_["sb_art_side"];401let d_ = w_;402return [w_, d_];403}404if (plot_type_ == "art_sec"){405let w_ = plot_dims_["part_sec_d"] - plot_dims_["sb_sec_front"] - plot_dims_["sb_art_side"];406let d_ = plot_dims_["part_art_d"] - plot_dims_["sb_art_front"] - plot_dims_["sb_sec_side"];407return [w_, d_];408}409if (plot_type_ == "art_loc"){410let w_ = plot_dims_["part_loc_d"] - plot_dims_["sb_loc_front"] - plot_dims_["sb_art_side"];411let d_ = plot_dims_["part_art_d"] - plot_dims_["sb_art_front"] - plot_dims_["sb_loc_side"];412return [w_, d_];413}414if (plot_type_ == "art"){415let w_ = plot_dims_["plot_art_w"] - (2 * plot_dims_["sb_art_side"]);416let d_ = plot_dims_["part_art_d"] - plot_dims_["sb_art_front"] - plot_dims_["sb_art_back"];417return [w_, d_];418}419if (plot_type_ == "sec_sec"){420let w_ = plot_dims_["part_sec_d"] - plot_dims_["sb_sec_front"] - plot_dims_["sb_sec_side"];421let d_ = w_;422return [w_, d_];423}424if (plot_type_ == "sec_loc"){425let w_ = plot_dims_["part_loc_d"] - plot_dims_["sb_loc_front"] - plot_dims_["sb_sec_side"];426let d_ = plot_dims_["part_sec_d"] - plot_dims_["sb_sec_front"] - plot_dims_["sb_loc_side"];427return [w_, d_];428}429if (plot_type_ == "sec"){430let w_ = plot_dims_["plot_sec_w"] - (2 * plot_dims_["sb_sec_side"]);431let d_ = plot_dims_["part_sec_d"] - plot_dims_["sb_sec_front"] - plot_dims_["sb_sec_back"];432return [w_, d_];433}434if (plot_type_ == "loc_loc"){435let w_ = plot_dims_["part_loc_d"] - plot_dims_["sb_loc_front"] - plot_dims_["sb_loc_side"];436let d_ = w_;437return [w_, d_];438}439if (plot_type_ == "loc"){440let w_ = plot_dims_["plot_loc_w"] - (2 * plot_dims_["sb_loc_side"]);441let d_ = plot_dims_["part_loc_d"] - plot_dims_["sb_loc_front"] - plot_dims_["sb_loc_back"];442return [w_, d_];443}444if (plot_type_ == "off_grid0" || plot_type_ == "off_grid1"){445let w_ = plot_dims_["plot_og_w"] - (2 * plot_dims_["sb_og_side"]);446let d_ = plot_dims_["plot_og_d"] - plot_dims_["sb_og_front"] - plot_dims_["sb_og_back"];447return [w_, d_];448}449if (plot_type_ == "off_grid2"){450let w_ = plot_dims_["plot_og2_w"] - (2 * plot_dims_["sb_og_side"]);451let d_ = plot_dims_["plot_og2_d"] - plot_dims_["sb_og_front"] - plot_dims_["sb_og_back"];452return [w_, d_];453}454let type_not_found_ = plot_type_;455return [0, 0];456}457async function exec_Building_starter_node_549psa6t6a_getBldgParams_(__params__, plot_type_) {458let result_ = [0, 0, 0];459if (plot_type_ == "art_art"){460return [pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_];461}462if (plot_type_ == "art_sec"){463return [pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_];464}465if (plot_type_ == "art_loc"){466return [pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_];467}468if (plot_type_ == "art"){469return [pcen_art_w_, pcen_art_d_, pcen_art_f_];470}471if (plot_type_ == "sec_sec"){472return [pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_];473}474if (plot_type_ == "sec_loc"){475return [pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_];476}477if (plot_type_ == "sec"){478return [pcen_sec_w_, pcen_sec_d_, pcen_sec_f_];479}480if (plot_type_ == "loc_loc"){481return [pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_];482}483if (plot_type_ == "loc"){484return [pcen_loc_w_, pcen_loc_d_, pcen_loc_f_];485}486if (plot_type_ == "off_grid2"){487return [pcen_og2_w_, pcen_og2_d_, pcen_og2_f_];488}489if (strStarts(plot_type_, "off")){490return [pcen_og_w_, pcen_og_d_, pcen_og_f_];491}492return result_;493}494async function exec_Building_starter_node_549psa6t6a_getBldgDims_(__params__, plot_type_) {495let result_ = await exec_Building_starter_node_549psa6t6a_getPermisDims_(__params__, plot_type_);496if (__params__.terminated) { return __params__.model;}497let w_ = result_[pythonList(0, result_.length)];498let d_ = result_[pythonList(1, result_.length)];499result_ = await exec_Building_starter_node_549psa6t6a_getBldgParams_(__params__, plot_type_);500if (__params__.terminated) { return __params__.model;}501let pcen_w_ = result_[pythonList(0, result_.length)];502let pcen_d_ = result_[pythonList(1, result_.length)];503return [w_ * (pcen_w_ / 100), d_ * (pcen_d_ / 100)];504}505async function exec_Building_starter_node_549psa6t6a_getFrontStart_(__params__, front_, mid_, cross_axes_, bldg_dims_) {506let bldg_w_ = bldg_dims_[pythonList(0, bldg_dims_.length)];507let verts_ = __modules__.query.Get(__params__.model, '_v', front_);508let next_edge_ = __modules__.query.Get(__params__.model, '_e', verts_[pythonList(1, verts_.length)])[pythonList(1, __modules__.query.Get(__params__.model, '_e', verts_[pythonList(1, verts_.length)]).length)];509let next_type_ = __modules__.attrib.Get(__params__.model, next_edge_, 'road');510let next_len_ = __modules__.calc.Length( __params__.model, next_edge_ );511let corner_ = 0;512if (next_len_ > 0.2 && next_type_){513if (strStarts(next_type_, "road")){514corner_ = 1;515}516else {517if(strStarts(next_type_, "entr")){518corner_ = 1;519}520else {521if(next_type_ == "green" || next_type_ == "path"){522corner_ = 1;523}524}525}526}527let front_len_ = __modules__.calc.Length( __params__.model, front_ );528let front_xyzs_ = __modules__.attrib.Get(__params__.model, __modules__.query.Get(__params__.model, 'ps', verts_), 'xyz');529let front_left_ = front_xyzs_[pythonList(0, front_xyzs_.length)];530let front_right_ = front_xyzs_[pythonList(1, front_xyzs_.length)];531let cross_left_ = vecAdd(mid_, cross_axes_[pythonList(0, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(0, cross_axes_.length)].length)]);532let cross_right_ = vecAdd(mid_, cross_axes_[pythonList(1, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(1, cross_axes_.length)].length)]);533let vec_left_ = vecNorm(vecFromTo(mid_, front_left_));534let vec_right_ = vecNorm(vecFromTo(mid_, front_right_));535let dist_to_c_left_ = vecDot(vecFromTo(mid_, cross_left_), vec_left_);536let dist_to_c_right_ = vecDot(vecFromTo(mid_, cross_right_), vec_right_);537let dist_to_f_left_ = vecDot(vecFromTo(mid_, front_left_), vec_left_);538let dist_to_f_right_ = vecDot(vecFromTo(mid_, front_right_), vec_right_);539let olap_left_ = front_left_;540let olap_right_ = front_right_;541if (dist_to_c_left_ < dist_to_f_left_){542olap_left_ = cross_left_;543}544if (dist_to_c_right_ < dist_to_f_right_){545olap_right_ = cross_right_;546}547let len_overlap_ = distance(olap_left_, olap_right_);548if (corner_ == 0 && bldg_w_ < len_overlap_){549return olap_left_;550}551if (corner_ == 1 && bldg_w_ < len_overlap_){552return vecAdd(olap_right_, vecSetLen(vec_left_, bldg_w_));553}554let len_olap_left_cross_right_ = distance(olap_left_, cross_right_);555if (corner_ == 0 && bldg_w_ < len_olap_left_cross_right_){556return olap_left_;557}558let len_cross_left_olap_right_ = distance(cross_left_, olap_right_);559if (corner_ == 1 && bldg_w_ < len_cross_left_olap_right_){560return vecAdd(olap_right_, vecSetLen(vec_left_, bldg_w_));561}562if (bldg_w_ < len_olap_left_cross_right_){563return olap_left_;564}565if (bldg_w_ < len_cross_left_olap_right_){566return vecAdd(olap_right_, vecSetLen(vec_left_, bldg_w_));567}568if (bldg_w_ < distance(cross_left_, cross_right_)){569return cross_left_;570}571return front_left_;572}573async function exec_Building_starter_node_549psa6t6a__isect_(__params__, ray_, rays_) {574for (let i_ of range(len(rays_))){575let a_ray_ = rays_[pythonList(i_, rays_.length)];576let isect_ = intersect(ray_, a_ray_, 0);577if (isect_ != null){578return [isect_, i_];579}580}581return null;582}583async function exec_Building_starter_node_549psa6t6a(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){584while (true) {585__modules__._model.__preprocess__( __params__.model);586let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "max_footprint");587for (let footprint_ of footprints_){588if (strEnds( __modules__.attrib.Get(__params__.model, footprint_, 'type'), "am")){589let am_bldg_footprints_ = await exec_Building_starter_node_549psa6t6a_createBldgAmen_(__params__, footprint_);590if (__params__.terminated) { return __params__.model;}591}592else {593let bldg_footprints_ = await exec_Building_starter_node_549psa6t6a_createBldg_(__params__, footprint_);594if (__params__.terminated) { return __params__.model;}595}596}597__modules__.modify.Delete( __params__.model, footprints_, 'delete_selected' );598__modules__._model.__postprocess__( __params__.model);599break; }600return __params__.model;601}602async function exec_Building_starter_node_dn467r9w96k_getNumFloors_(__params__, footprint_, plot_type_) {603if (strEnds(plot_type_, "_am")){604plot_type_ = plot_type_.slice(0,-3);605}606let pcen_floors_ = await exec_Building_starter_node_dn467r9w96k__getBldgParams_(__params__, plot_type_);607if (__params__.terminated) { return __params__.model;}608let max_floors_ = __modules__.attrib.Get(__params__.model, footprint_, 'max_floors');609return ceil(max_floors_ * (pcen_floors_ / 100));610}611async function exec_Building_starter_node_dn467r9w96k__getBldgParams_(__params__, plot_type_) {612let result_ = 0;613if (plot_type_ == "art_art"){614return pcen_art_art_f_;615}616if (plot_type_ == "art_sec"){617return pcen_art_sec_f_;618}619if (plot_type_ == "art_loc"){620return pcen_art_loc_f_;621}622if (plot_type_ == "art"){623return pcen_art_f_;624}625if (plot_type_ == "sec_sec"){626return pcen_sec_sec_f_;627}628if (plot_type_ == "sec_loc"){629return pcen_sec_loc_f_;630}631if (plot_type_ == "sec"){632return pcen_sec_f_;633}634if (plot_type_ == "loc_loc"){635return pcen_loc_loc_f_;636}637if (plot_type_ == "loc"){638return pcen_loc_f_;639}640if (plot_type_ == "off_grid2"){641return pcen_og2_f_;642}643if (strStarts(plot_type_, "off")){644return pcen_og_f_;645}646return result_;647}648async function exec_Building_starter_node_dn467r9w96k(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){649while (true) {650__modules__._model.__preprocess__( __params__.model);651let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_footprint");652for (let footprint_ of footprints_){653let type_ = __modules__.attrib.Get(__params__.model, footprint_, 'type');654let num_floors_ = await exec_Building_starter_node_dn467r9w96k_getNumFloors_(__params__, footprint_, type_);655if (__params__.terminated) { return __params__.model;}656if (num_floors_ > 0){657let bldg_ = __modules__.make.Extrude( __params__.model, footprint_, num_floors_ * 3, num_floors_, 'quads' );658__modules__.attrib.Set(__params__.model, bldg_, 'type', type_ );659__modules__.attrib.Set(__params__.model, bldg_.slice(0,-1), 'class', "bldg_facade" );660__modules__.attrib.Set(__params__.model, bldg_[pythonList(-1, bldg_.length)], 'class', "bldg_roof" );661}662}663__modules__._model.__postprocess__( __params__.model);664break; }665return __params__.model;666}667async function exec_Building_starter_node_8lrb9z2ypba_applyColours_(__params__, colors_dict_, pgons_) {668let pgons_lists_ = {};669let cols_ = {};670let keys_ = [];671for (let pgon_ of pgons_){672let type_ = __modules__.attrib.Get(__params__.model, pgon_, 'type');673let col_ = colors_dict_[pythonList(type_, colors_dict_.length)];674if (col_ != undefined){675let key_ = string(col_);676let pgons_list_ = pgons_lists_[pythonList(key_, pgons_lists_.length)];677if (pgons_list_ == undefined){678pgons_list_ = [];679pgons_lists_[pythonList(key_, pgons_lists_.length)] = pgons_list_;680cols_[pythonList(key_, cols_.length)] = col_;681__modules__.list.Add( keys_, key_, 'to_end' );682}683__modules__.list.Add( pgons_list_, pgon_, 'to_end' );684}685}686for (let key_ of keys_){687pgons_ = pgons_lists_[pythonList(key_, pgons_lists_.length)];688let col_ = cols_[pythonList(key_, cols_.length)];689__modules__.visualize.Color( __params__.model, pgons_, col_ );690}691}692async function exec_Building_starter_node_8lrb9z2ypba(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){693while (true) {694__modules__._model.__preprocess__( __params__.model);695let colors_dict_land_ = {};696colors_dict_land_["art_art"] = [0.8, 0.51, 0.48];697colors_dict_land_["art_sec"] = [0.85, 0.62, 0.6];698colors_dict_land_["art_loc"] = [0.9, 0.73, 0.72];699colors_dict_land_["art"] = [0.92, 0.79, 0.78];700colors_dict_land_["sec_sec"] = [0.98, 0.81, 0.69];701colors_dict_land_["sec_loc"] = [0.98, 0.86, 0.78];702colors_dict_land_["sec"] = [0.98, 0.91, 0.86];703colors_dict_land_["loc_loc"] = [0.98, 0.92, 0.73];704colors_dict_land_["loc"] = [0.98, 0.95, 0.83];705colors_dict_land_["entr0"] = [1, 0.98, 0.92];706colors_dict_land_["entr1"] = [1, 0.98, 0.92];707colors_dict_land_["off_grid"] = [0.81, 0.9, 0.95];708colors_dict_land_["off_grid0"] = [0.81, 0.9, 0.95];709colors_dict_land_["off_grid1"] = [0.68, 0.83, 0.9];710colors_dict_land_["off_grid2"] = [0.68, 0.83, 0.9];711colors_dict_land_["path0"] = [0.93, 1, 0.9];712colors_dict_land_["path1"] = [0.93, 1, 0.9];713colors_dict_land_["path2"] = [0.93, 1, 0.9];714colors_dict_land_["green0"] = [0.86, 0.95, 0.81];715colors_dict_land_["green1"] = [0.86, 0.95, 0.81];716colors_dict_land_["green2"] = [0.86, 0.95, 0.81];717colors_dict_land_["off_grid0_os"] = [0.75, 0.9, 0.67];718colors_dict_land_["off_grid1_os"] = [0.75, 0.9, 0.67];719colors_dict_land_["off_grid2_os"] = [0.75, 0.9, 0.67];720colors_dict_land_["loc_os"] = [0.75, 0.9, 0.67];721colors_dict_land_["loc_loc_os"] = [0.75, 0.9, 0.67];722colors_dict_land_["sec_os"] = [0.75, 0.9, 0.67];723colors_dict_land_["sec_loc_os"] = [0.75, 0.9, 0.67];724colors_dict_land_["sec_sec_os"] = [0.75, 0.9, 0.67];725colors_dict_land_["corner_park"] = [0.75, 0.9, 0.67];726colors_dict_land_["off_grid0_am"] = [0.85, 0.6, 0.66];727colors_dict_land_["off_grid1_am"] = [0.85, 0.6, 0.66];728colors_dict_land_["off_grid2_am"] = [0.85, 0.6, 0.66];729colors_dict_land_["loc_am"] = [0.85, 0.6, 0.66];730colors_dict_land_["loc_loc_am"] = [0.85, 0.6, 0.66];731colors_dict_land_["sec_am"] = [0.85, 0.6, 0.66];732colors_dict_land_["sec_loc_am"] = [0.85, 0.6, 0.66];733colors_dict_land_["sec_sec_am"] = [0.85, 0.6, 0.66];734colors_dict_land_["off_grid_too_small"] = [1, 0.7, 1];735colors_dict_land_["too_deep"] = [1, 0.7, 1];736colors_dict_land_["concave_corner"] = [1, 0.7, 1];737colors_dict_land_["leftover"] = [1, 0.7, 1];738let colors_dict_bldg_ = {};739colors_dict_bldg_["art_art"] = [0.8, 0.18, 0.12];740colors_dict_bldg_["art_sec"] = [0.85, 0.3, 0.25];741colors_dict_bldg_["art_loc"] = [0.9, 0.48, 0.45];742colors_dict_bldg_["art"] = [0.93, 0.59, 0.56];743colors_dict_bldg_["sec_sec"] = [0.98, 0.55, 0.24];744colors_dict_bldg_["sec_loc"] = [0.98, 0.65, 0.44];745colors_dict_bldg_["sec"] = [0.98, 0.75, 0.59];746colors_dict_bldg_["loc_loc"] = [0.98, 0.83, 0.34];747colors_dict_bldg_["loc"] = [0.98, 0.89, 0.59];748colors_dict_bldg_["off_grid"] = [0.54, 0.78, 0.9];749colors_dict_bldg_["off_grid0"] = [0.54, 0.78, 0.9];750colors_dict_bldg_["off_grid1"] = [0.54, 0.78, 0.9];751colors_dict_bldg_["off_grid2"] = [0.36, 0.66, 0.8];752colors_dict_bldg_["off_grid0_am"] = [0.75, 0.38, 0.47];753colors_dict_bldg_["off_grid1_am"] = [0.75, 0.38, 0.47];754colors_dict_bldg_["off_grid2_am"] = [0.75, 0.38, 0.47];755colors_dict_bldg_["loc_am"] = [0.75, 0.38, 0.47];756colors_dict_bldg_["loc_loc_am"] = [0.75, 0.38, 0.47];757colors_dict_bldg_["sec_am"] = [0.75, 0.38, 0.47];758colors_dict_bldg_["sec_loc_am"] = [0.75, 0.38, 0.47];759colors_dict_bldg_["sec_sec_am"] = [0.75, 0.38, 0.47];760let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_footprint");761let facades_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_facade");762let roofs_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_roof");763await exec_Building_starter_node_8lrb9z2ypba_applyColours_(__params__, colors_dict_bldg_, listFlat([footprints_, facades_, roofs_]));764if (__params__.terminated) { return __params__.model;}765__modules__._model.__postprocess__( __params__.model);766break; }767return __params__.model;768}769async function exec_Building_starter_node_4fznbcf45t_tree4half_(__params__, height_) {770let height_step_ = height_ / 6;771let width_ = (height_ / 3);772let width_step_ = width_ / 6;773let xyz0_ = [0, 0, 0];774let xyz1_ = [0.25, 0, 0];775let xyz2_ = [0.15, 0, height_step_ * 2];776let xyz3_ = [width_step_ * 3, 0, height_step_ * 3];777let xyz4_ = [width_, 0, height_step_ * 4];778let xyz5_ = [width_step_ * 3, 0, height_step_ * 5];779let xyz6_ = [0, 0, height_];780let xyzs_ = [xyz0_, xyz1_, xyz2_, xyz3_, xyz4_, xyz5_, xyz6_];781let mirror_ = [];782for (let i_ of range(0, len(xyzs_))){783if (i_ > 0 && i_ < len(xyzs_) - 1){784let xyzs_mirror_ = [xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] * -1, 0, xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)]];785__modules__.list.Add( mirror_, xyzs_mirror_, 'to_start' );786}787}788xyzs_ = listJoin(xyzs_, mirror_);789for (let i_ of range(0, len(xyzs_))){790if (i_ > 2 && i_ < len(xyzs_) - 2 && i_ != 6){791xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)] = xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)] + rand(-height_step_, height_step_);792xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] = xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] + rand(-width_step_, width_step_);793}794}795return xyzs_;796}797async function exec_Building_starter_node_4fznbcf45t_tree4_(__params__, posi_, height_) {798let all_xyzs_ = [];799let cen_ = __modules__.attrib.Get(__params__.model, posi_, 'xyz');800let pln_ = [cen_, [1, 0, 0], [0, 1, 0]];801pln_ = plnLRotZ(pln_, JSON.parse(JSON.stringify(PI)) * rand(0, 1));802let height_step_ = height_ / 6;803height_ = height_ + rand(-height_step_, height_step_);804for (let i_ of range(2)){805pln_ = plnLRotZ(pln_, (JSON.parse(JSON.stringify(PI)) / 2) * i_);806let xyzs_ = await exec_Building_starter_node_4fznbcf45t_tree4half_(__params__, height_);807if (__params__.terminated) { return __params__.model;}808let xyzs2_ = vecGtoL(xyzs_, pln_);809__modules__.list.Add( all_xyzs_, xyzs2_, 'to_end' );810}811let posis_ = __modules__.make.Position( __params__.model, all_xyzs_ );812let canopy_ = __modules__.make.Polygon( __params__.model, posis_ );813return canopy_;814}815async function exec_Building_starter_node_4fznbcf45t(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){816while (true) {817__modules__._model.__preprocess__( __params__.model);818let trees_ = [];819if (__modules__.attrib.Get(__params__.model, null, 'add_trees')){820let tree_pts_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pt', null), ['type', null], '==', "tree");821for (let tree_pt_ of tree_pts_){822let tree_ = await exec_Building_starter_node_4fznbcf45t_tree4_(__params__, __modules__.query.Get(__params__.model, 'ps', tree_pt_)[pythonList(0, __modules__.query.Get(__params__.model, 'ps', tree_pt_).length)], __modules__.attrib.Get(__params__.model, null, 'tree_height_start'));823if (__params__.terminated) { return __params__.model;}824__modules__.list.Add( trees_, tree_, 'extend_end' );825}826}827__modules__.visualize.Color( __params__.model, trees_, [0.5, 1, 0.5] );828__modules__._model.__postprocess__( __params__.model);829break; }830return __params__.model;831}832async function exec_Building_starter_node_7gepyjg285l(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){833while (true) {834__modules__._model.__preprocess__( __params__.model);835let data_ = {};836data_["param_pcen_art_art_w"] = pcen_art_art_w_;837data_["param_pcen_art_sec_w"] = pcen_art_sec_w_;838data_["param_pcen_art_loc_w"] = pcen_art_loc_w_;839data_["param_pcen_art_w"] = pcen_art_w_;840data_["param_pcen_sec_sec_w"] = pcen_sec_sec_w_;841data_["param_pcen_sec_loc_w"] = pcen_sec_loc_w_;842data_["param_pcen_sec_w"] = pcen_sec_w_;843data_["param_pcen_loc_loc_w"] = pcen_loc_loc_w_;844data_["param_pcen_loc_w"] = pcen_loc_w_;845data_["param_pcen_og_w"] = pcen_og_w_;846data_["param_pcen_og2_w"] = pcen_og2_w_;847data_["param_pcen_art_art_d"] = pcen_art_art_d_;848data_["param_pcen_art_sec_d"] = pcen_art_sec_d_;849data_["param_pcen_art_loc_d"] = pcen_art_loc_d_;850data_["param_pcen_art_d"] = pcen_art_d_;851data_["param_pcen_sec_sec_d"] = pcen_sec_sec_d_;852data_["param_pcen_sec_loc_d"] = pcen_sec_loc_d_;853data_["param_pcen_sec_d"] = pcen_sec_d_;854data_["param_pcen_loc_loc_d"] = pcen_loc_loc_d_;855data_["param_pcen_loc_d"] = pcen_loc_d_;856data_["param_pcen_og_d"] = pcen_og_d_;857data_["param_pcen_og2_d"] = pcen_og2_d_;858data_["param_pcen_art_art_f"] = pcen_art_art_f_;859data_["param_pcen_art_sec_f"] = pcen_art_sec_f_;860data_["param_pcen_art_loc_f"] = pcen_art_loc_f_;861data_["param_pcen_art_f"] = pcen_art_f_;862data_["param_pcen_sec_sec_f"] = pcen_sec_sec_f_;863data_["param_pcen_sec_loc_f"] = pcen_sec_loc_f_;864data_["param_pcen_sec_f"] = pcen_sec_f_;865data_["param_pcen_loc_loc_f"] = pcen_loc_loc_f_;866data_["param_pcen_loc_f"] = pcen_loc_f_;867data_["param_pcen_og_f"] = pcen_og_f_;868data_["param_pcen_og2_f"] = pcen_og2_f_;869let __return_value__ = __modules__._Output.Return(__params__.model, data_);870return __return_value__;871break; }872}873var merged;874console.log("Executing Node: Start");875let result_exec_Building_starter_node_w5xf0jmbotm = __params__.model;876console.log("Executing Node: import");877__params__.model = result_exec_Building_starter_node_w5xf0jmbotm;878let result_exec_Building_starter_node_wz73f8oew4 = await exec_Building_starter_node_wz73f8oew4(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);879console.log("Executing Node: gen footprints by axes");880__params__.model = result_exec_Building_starter_node_wz73f8oew4;881let result_exec_Building_starter_node_549psa6t6a = await exec_Building_starter_node_549psa6t6a(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);882console.log("Executing Node: floors");883__params__.model = result_exec_Building_starter_node_549psa6t6a;884let result_exec_Building_starter_node_dn467r9w96k = await exec_Building_starter_node_dn467r9w96k(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);885console.log("Executing Node: colors");886__params__.model = result_exec_Building_starter_node_dn467r9w96k;887let result_exec_Building_starter_node_8lrb9z2ypba = await exec_Building_starter_node_8lrb9z2ypba(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);888console.log("Executing Node: trees");889__params__.model = result_exec_Building_starter_node_8lrb9z2ypba;890let result_exec_Building_starter_node_4fznbcf45t = await exec_Building_starter_node_4fznbcf45t(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);891console.log("Executing Node: End");892__params__.model = result_exec_Building_starter_node_4fznbcf45t;893let result_exec_Building_starter_node_7gepyjg285l = await exec_Building_starter_node_7gepyjg285l(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);894return result_exec_Building_starter_node_7gepyjg285l;895}896function pythonList(x, l){897 if (x < 0) {898 return x + l;899 }900 return x;901}902function mergeInputs(models){903 let result = null;904 if (models.length === 0) {905 result = __modules__._model.__new__();906 } else if (models.length === 1) {907 result = models[0].clone();908 } else {909 result = models[0].clone();910 for (let i = 1; i < models.length; i++) {911 __modules__._model.__merge__(result, models[i]);912 }913 }914 try {915 result.debug = __debug__;916 } catch (ex) {}917 return result;918}919function duplicateModel(model){920 const result = model.clone();921 try {922 result.debug = __debug__;923 } catch (ex) {}924 return result;925}926function printFunc(_console, name, value){927 let val;928 if (!value) {929 val = value;930 } else if (value === '__null__') {931 console.log('_ ' + name);932 return value;933 } else if (typeof value === 'number' || value === undefined) {934 val = value;935 } else if (typeof value === 'string') {936 val = value;937 } else if (value.constructor === [].constructor) {938 let __list_check__ = false;939 let __value_strings__ = [];940 for (const __item__ of value) {941 if (!__item__) {942 __value_strings__.push('' + __item__);943 continue;944 }945 if (__item__.constructor === [].constructor || __item__.constructor === {}.constructor) {946 __list_check__ = true;947 }948 __value_strings__.push(JSON.stringify(__item__).replace(/,/g, ', '));949 }950 if (__list_check__) {951 val = '[\n' + __value_strings__.join(',\n') + '\n]';952 } else {953 val = '[' + __value_strings__.join(', ') + ']';954 }955 } else if (value.constructor === {}.constructor) {956 let __list_check__ = false;957 let __value_strings__ = [];958 for (const __item__ in value) {959 const __value__ = value[__item__];960 if (!__value__) {961 __value_strings__.push( __item__ + ': ' + __value__);962 continue;963 }964 if (__value__.constructor === [].constructor || __value__.constructor === {}.constructor) {965 __list_check__ = true;966 }967 __value_strings__.push(__item__ + ': ' + JSON.stringify(__value__).replace(/,/g, ', '));968 }969 if (__list_check__) {970 val = '{\n' + __value_strings__.join(',\n') + '\n}';971 } else {972 val = '{' + __value_strings__.join(', ') + '}';973 }974 } else {975 val = value;976 }977 // console.log(name + ' = ' + val);978 return val;979}980function printInp(in_model,pcen_art_art_w,pcen_art_art_d,pcen_art_art_f,pcen_art_sec_w,pcen_art_sec_d,pcen_art_sec_f,pcen_art_loc_w,pcen_art_loc_d,pcen_art_loc_f,pcen_art_w,pcen_art_d,pcen_art_f,pcen_sec_sec_w,pcen_sec_sec_d,pcen_sec_sec_f,pcen_sec_loc_w,pcen_sec_loc_d,pcen_sec_loc_f,pcen_sec_w,pcen_sec_d,pcen_sec_f,pcen_loc_loc_w,pcen_loc_loc_d,pcen_loc_loc_f,pcen_loc_w,pcen_loc_d,pcen_loc_f,pcen_og_w,pcen_og_d,pcen_og_f,pcen_og2_w,pcen_og2_d,pcen_og2_f){981console.log("Calling function Building_starter() with the following arguments:\n" +982" in_model = " + in_model + "\n" +983" pcen_art_art_w = " + pcen_art_art_w + "\n" +984" pcen_art_art_d = " + pcen_art_art_d + "\n" +985" pcen_art_art_f = " + pcen_art_art_f + "\n" +986" pcen_art_sec_w = " + pcen_art_sec_w + "\n" +987" pcen_art_sec_d = " + pcen_art_sec_d + "\n" +988" pcen_art_sec_f = " + pcen_art_sec_f + "\n" +989" pcen_art_loc_w = " + pcen_art_loc_w + "\n" +990" pcen_art_loc_d = " + pcen_art_loc_d + "\n" +991" pcen_art_loc_f = " + pcen_art_loc_f + "\n" +992" pcen_art_w = " + pcen_art_w + "\n" +993" pcen_art_d = " + pcen_art_d + "\n" +994" pcen_art_f = " + pcen_art_f + "\n" +995" pcen_sec_sec_w = " + pcen_sec_sec_w + "\n" +996" pcen_sec_sec_d = " + pcen_sec_sec_d + "\n" +997" pcen_sec_sec_f = " + pcen_sec_sec_f + "\n" +998" pcen_sec_loc_w = " + pcen_sec_loc_w + "\n" +999" pcen_sec_loc_d = " + pcen_sec_loc_d + "\n" +1000" pcen_sec_loc_f = " + pcen_sec_loc_f + "\n" +1001" pcen_sec_w = " + pcen_sec_w + "\n" +1002" pcen_sec_d = " + pcen_sec_d + "\n" +1003" pcen_sec_f = " + pcen_sec_f + "\n" +1004" pcen_loc_loc_w = " + pcen_loc_loc_w + "\n" +1005" pcen_loc_loc_d = " + pcen_loc_loc_d + "\n" +1006" pcen_loc_loc_f = " + pcen_loc_loc_f + "\n" +1007" pcen_loc_w = " + pcen_loc_w + "\n" +1008" pcen_loc_d = " + pcen_loc_d + "\n" +1009" pcen_loc_f = " + pcen_loc_f + "\n" +1010" pcen_og_w = " + pcen_og_w + "\n" +1011" pcen_og_d = " + pcen_og_d + "\n" +1012" pcen_og_f = " + pcen_og_f + "\n" +1013" pcen_og2_w = " + pcen_og2_w + "\n" +1014" pcen_og2_d = " + pcen_og2_d + "\n" +1015" pcen_og2_f = " + pcen_og2_f + "\n" +1016'')};1017// printInp(in_model,pcen_art_art_w,pcen_art_art_d,pcen_art_art_f,pcen_art_sec_w,pcen_art_sec_d,pcen_art_sec_f,pcen_art_loc_w,pcen_art_loc_d,pcen_art_loc_f,pcen_art_w,pcen_art_d,pcen_art_f,pcen_sec_sec_w,pcen_sec_sec_d,pcen_sec_sec_f,pcen_sec_loc_w,pcen_sec_loc_d,pcen_sec_loc_f,pcen_sec_w,pcen_sec_d,pcen_sec_f,pcen_loc_loc_w,pcen_loc_loc_d,pcen_loc_loc_f,pcen_loc_w,pcen_loc_d,pcen_loc_f,pcen_og_w,pcen_og_d,pcen_og_f,pcen_og2_w,pcen_og2_d,pcen_og2_f);1018const __params__ = {};1019__params__["model"] = __modules__._model.__new__();1020if (__model__) {1021__modules__.io._importGI(__params__["model"], __model__);1022}1023__params__["model"].debug = __debug__;1024__params__["console"] = [];1025__params__["modules"] = __modules__;1026const result = await exec_Building_starter(__params__, in_model, pcen_art_art_w, pcen_art_art_d, pcen_art_art_f, pcen_art_sec_w, pcen_art_sec_d, pcen_art_sec_f, pcen_art_loc_w, pcen_art_loc_d, pcen_art_loc_f, pcen_art_w, pcen_art_d, pcen_art_f, pcen_sec_sec_w, pcen_sec_sec_d, pcen_sec_sec_f, pcen_sec_loc_w, pcen_sec_loc_d, pcen_sec_loc_f, pcen_sec_w, pcen_sec_d, pcen_sec_f, pcen_loc_loc_w, pcen_loc_loc_d, pcen_loc_loc_f, pcen_loc_w, pcen_loc_d, pcen_loc_f, pcen_og_w, pcen_og_d, pcen_og_f, pcen_og2_w, pcen_og2_d, pcen_og2_f);1027if (result === __params__.model) { return { "model": __params__.model, "result": null };}1028return {"model": __params__.model, "result": result};1029/** * **/1030}...
starter_building21.js
Source:starter_building21.js
1/**2 * to use this code: import Building_starter from this js file as well as the GI module3 * run Building_starter with the GI module as input along with other start node input4 * e.g.:5 * const Building_starter = require('./Building_starter.js').Building_starter6 * const module = require('gi-module')7 * const result = await Building_starter(module, start_input_1, start_input_2, ...);8 *9 * returns: a json object:10 * _ result.model -> gi model of the flowchart11 * _ result.result -> returned output of the flowchart, if the flowchart does not return any value, result.result is the model of the flowchart12 */13// Parameter: {"name":"pcen_art_art_w","value":"0","type":1,"min":"0","max":"100","step":"1"}14// Parameter: {"name":"pcen_art_art_d","value":"0","type":1,"min":"0","max":"100","step":"1"}15// Parameter: {"name":"pcen_art_art_f","value":"0","type":1,"min":"0","max":"100","step":"1"}16// Parameter: {"name":"pcen_art_sec_w","value":"0","type":1,"min":"0","max":"100","step":"1"}17// Parameter: {"name":"pcen_art_sec_d","value":"0","type":1,"min":"0","max":"100","step":"1"}18// Parameter: {"name":"pcen_art_sec_f","value":"0","type":1,"min":"0","max":"100","step":"1"}19// Parameter: {"name":"pcen_art_loc_w","value":0,"type":1,"min":"0","max":"100","step":"1"}20// Parameter: {"name":"pcen_art_loc_d","value":0,"type":1,"min":"0","max":"100","step":"1"}21// Parameter: {"name":"pcen_art_loc_f","value":0,"type":1,"min":"0","max":"100","step":"1"}22// Parameter: {"name":"pcen_art_w","value":"100","type":1,"min":"0","max":"100","step":"1"}23// Parameter: {"name":"pcen_art_d","value":"60","type":1,"min":"0","max":"100","step":"1"}24// Parameter: {"name":"pcen_art_f","value":"80","type":1,"min":"0","max":"100","step":"1"}25// Parameter: {"name":"pcen_sec_sec_w","value":"0","type":1,"min":"0","max":"100","step":"1"}26// Parameter: {"name":"pcen_sec_sec_d","value":"0","type":1,"min":"0","max":"100","step":"1"}27// Parameter: {"name":"pcen_sec_sec_f","value":"0","type":1,"min":"0","max":"100","step":"1"}28// Parameter: {"name":"pcen_sec_loc_w","value":"0","type":1,"min":"0","max":"100","step":"1"}29// Parameter: {"name":"pcen_sec_loc_d","value":"0","type":1,"min":"0","max":"100","step":"1"}30// Parameter: {"name":"pcen_sec_loc_f","value":"0","type":1,"min":"0","max":"100","step":"1"}31// Parameter: {"name":"pcen_sec_w","value":"100","type":1,"min":"0","max":"100","step":"1"}32// Parameter: {"name":"pcen_sec_d","value":"70","type":1,"min":"0","max":"100","step":"1"}33// Parameter: {"name":"pcen_sec_f","value":"80","type":1,"min":"0","max":"100","step":"1"}34// Parameter: {"name":"pcen_loc_loc_w","value":"100","type":1,"min":"0","max":"100","step":"1"}35// Parameter: {"name":"pcen_loc_loc_d","value":"100","type":1,"min":"0","max":"100","step":"1"}36// Parameter: {"name":"pcen_loc_loc_f","value":"60","type":1,"min":"0","max":"100","step":"1"}37// Parameter: {"name":"pcen_loc_w","value":"100","type":1,"min":"0","max":"100","step":"1"}38// Parameter: {"name":"pcen_loc_d","value":"50","type":1,"min":"0","max":"100","step":"1"}39// Parameter: {"name":"pcen_loc_f","value":"60","type":1,"min":"0","max":"100","step":"1"}40// Parameter: {"name":"pcen_og_w","value":"50","type":1,"min":"0","max":"100","step":"1"}41// Parameter: {"name":"pcen_og_d","value":"50","type":1,"min":"0","max":"100","step":"1"}42// Parameter: {"name":"pcen_og_f","value":"50","type":1,"min":"0","max":"100","step":"1"}43// Parameter: {"name":"pcen_og2_w","value":100,"type":1,"min":"0","max":"100","step":"1"}44// Parameter: {"name":"pcen_og2_d","value":"30","type":1,"min":"0","max":"100","step":"1"}45// Parameter: {"name":"pcen_og2_f","value":"50","type":1,"min":"0","max":"100","step":"1"}46async function starter_building(__modules__, pcen_art_art_w, pcen_art_art_d, pcen_art_art_f, pcen_art_sec_w, pcen_art_sec_d, pcen_art_sec_f, pcen_art_loc_w, pcen_art_loc_d, pcen_art_loc_f, pcen_art_w, pcen_art_d, pcen_art_f, pcen_sec_sec_w, pcen_sec_sec_d, pcen_sec_sec_f, pcen_sec_loc_w, pcen_sec_loc_d, pcen_sec_loc_f, pcen_sec_w, pcen_sec_d, pcen_sec_f, pcen_loc_loc_w, pcen_loc_loc_d, pcen_loc_loc_f, pcen_loc_w, pcen_loc_d, pcen_loc_f, pcen_og_w, pcen_og_d, pcen_og_f, pcen_og2_w, pcen_og2_d, pcen_og2_f) {47const __debug__ = true;48const __model__ = null;49/** * **/50const PI = Math.PI;51const XY = __modules__._constants.XY;52const YZ = __modules__._constants.YZ;53const ZX = __modules__._constants.ZX;54const YX = __modules__._constants.YX;55const ZY = __modules__._constants.ZY;56const XZ = __modules__._constants.XZ;57const isNum = __modules__._types.isNum;58const isInt = __modules__._types.isInt;59const isFlt = __modules__._types.isFlt;60const isBool = __modules__._types.isBool;61const isStr = __modules__._types.isStr;62const isList = __modules__._types.isList;63const isDict = __modules__._types.isDict;64const isVec2 = __modules__._types.isVec2;65const isVec3 = __modules__._types.isVec3;66const isCol = __modules__._types.isCol;67const isRay = __modules__._types.isRay;68const isPln = __modules__._types.isPln;69const isNaN = __modules__._types.isNaN;70const isNull = __modules__._types.isNull;71const isUndef = __modules__._types.isUndef;72const strRepl = __modules__._strs.strRepl;73const strUpp = __modules__._strs.strUpp;74const strLow = __modules__._strs.strLow;75const strTrim = __modules__._strs.strTrim;76const strTrimR = __modules__._strs.strTrimR;77const strTrimL = __modules__._strs.strTrimL;78const strSub = __modules__._strs.strSub;79const strStarts = __modules__._strs.strStarts;80const strEnds = __modules__._strs.strEnds;81const strPadL = __modules__._strs.strPadL;82const strPadR = __modules__._strs.strPadR;83const isApprox = __modules__._util.isApprox;84const isIn = __modules__._util.isIn;85const isWithin = __modules__._util.isWithin;86const min = __modules__._math.min;87const max = __modules__._math.max;88const pow = Math.pow;89const sqrt = Math.sqrt;90const exp = Math.exp;91const log = Math.log;92const round = __modules__._math.round;93const sigFig = __modules__._math.sigFig;94const ceil = Math.ceil;95const floor = Math.floor;96const abs = Math.abs;97const sin = Math.sin;98const asin = Math.asin;99const sinh = Math.sinh;100const asinh = Math.asinh;101const cos = Math.cos;102const acos = Math.acos;103const cosh = Math.cosh;104const acosh = Math.acosh;105const tan = Math.tan;106const atan = Math.atan;107const tanh = Math.tanh;108const atanh = Math.atanh;109const atan2 = Math.atan2;110const boolean = __modules__._mathjs.boolean;111const number = __modules__._mathjs.number;112const string = __modules__._mathjs.string;113const mad = __modules__._mathjs.mad;114const mean = __modules__._mathjs.mean;115const median = __modules__._mathjs.median;116const mode = __modules__._mathjs.mode;117const prod = __modules__._mathjs.prod;118const std = __modules__._mathjs.std;119const vari = __modules__._mathjs.var;120const sum = __modules__._mathjs.sum;121const hypot = __modules__._mathjs.hypot;122const norm = __modules__._mathjs.norm;123const mod = __modules__._mathjs.mod;124const square = __modules__._mathjs.square;125const cube = __modules__._mathjs.cube;126const remap = __modules__._arithmetic.remap;127const distance = __modules__._geometry.distance;128const distanceM = __modules__._geometry.distanceM;129const distanceMS = __modules__._geometry.distanceMS;130const intersect = __modules__._geometry.intersect;131const project = __modules__._geometry.project;132const range = __modules__._list.range;133const len = __modules__._list.listLen;134const listLen = __modules__._list.listLen;135const listCount = __modules__._list.listCount;136const listCopy = __modules__._list.listCopy;137const listRep = __modules__._list.listRep;138const listLast = __modules__._list.listLast;139const listGet = __modules__._list.listGet;140const listFind = __modules__._list.listFind;141const listHas = __modules__._list.listHas;142const listJoin = __modules__._list.listJoin;143const listFlat = __modules__._list.listFlat;144const listSlice = __modules__._list.listSlice;145const listCull = __modules__._list.listCull;146const listZip = __modules__._list.listZip;147const listZip2 = __modules__._list.listZip2;148const listSort = __modules__._list.listSort;149const listRev = __modules__._list.listRev;150const setMake = __modules__._set.setMake;151const setUni = __modules__._set.setUni;152const setInt = __modules__._set.setInt;153const setDif = __modules__._set.setDif;154const length = __modules__._list.length;155const shuffle = __modules__._list.shuffle;156const concat = __modules__._list.concat;157const zip = __modules__._list.zip;158const zip2 = __modules__._list.zip2;159const vecAdd = __modules__._vec.vecAdd;160const vecSub = __modules__._vec.vecSub;161const vecDiv = __modules__._vec.vecDiv;162const vecMult = __modules__._vec.vecMult;163const vecSum = __modules__._vec.vecSum;164const vecLen = __modules__._vec.vecLen;165const vecSetLen = __modules__._vec.vecSetLen;166const vecNorm = __modules__._vec.vecNorm;167const vecRev = __modules__._vec.vecRev;168const vecFromTo = __modules__._vec.vecFromTo;169const vecAng = __modules__._vec.vecAng;170const vecAng2 = __modules__._vec.vecAng2;171const vecDot = __modules__._vec.vecDot;172const vecCross = __modules__._vec.vecCross;173const vecEqual = __modules__._vec.vecEqual;174const vecLtoG = __modules__._vec.vecLtoG;175const vecGtoL = __modules__._vec.vecGtoL;176const plnMake = __modules__._plane.plnMake;177const plnCopy = __modules__._plane.plnCopy;178const plnMove = __modules__._plane.plnMove;179const plnRot = __modules__._plane.plnRot;180const plnLMove = __modules__._plane.plnLMove;181const plnLRotX = __modules__._plane.plnLRotX;182const plnLRotY = __modules__._plane.plnLRotY;183const plnLRotZ = __modules__._plane.plnLRotZ;184const rayMake = __modules__._ray.rayMake;185const rayCopy = __modules__._ray.rayCopy;186const rayMove = __modules__._ray.rayMove;187const rayRot = __modules__._ray.rayRot;188const rayLMove = __modules__._ray.rayLMove;189const rayFromPln = __modules__._ray.rayFromPln;190const rayLtoG = __modules__._ray.rayLtoG;191const rayGtoL = __modules__._ray.rayGtoL;192const colFalse = __modules__._colors.colFalse;193const colScale = __modules__._colors.colScale;194const radToDeg = __modules__._conversion.radToDeg;195const degToRad = __modules__._conversion.degToRad;196const numToStr = __modules__._conversion.numToStr;197const rand = __modules__._rand.rand;198const randInt = __modules__._rand.randInt;199const randPick = __modules__._rand.randPick;200const setattr = __modules__._model.__setAttrib__;201const getattr = __modules__._model.__getAttrib__;202async function exec_Building_starter(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){203async function exec_Building_starter_node_wz73f8oew4(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){204while (true) {205__modules__._model.__preprocess__( __params__.model);206let coll_tissue_ = await __modules__.io.Import( __params__.model, "tissue.gi", 'gi' );207__modules__._model.__postprocess__( __params__.model);208break; }209return __params__.model;210}211async function exec_Building_starter_node_549psa6t6a_createBldg_(__params__, footprint_) {212let type_ = __modules__.attrib.Get(__params__.model, footprint_, 'type');213let bldg_parms_ = await exec_Building_starter_node_549psa6t6a_getBldgParams_(__params__, type_);214if (__params__.terminated) { return __params__.model;}215if ((bldg_parms_[pythonList(0, bldg_parms_.length)] == 0 && bldg_parms_[pythonList(1, bldg_parms_.length)] == 0) || (bldg_parms_[pythonList(2, bldg_parms_.length)] == 0)){216return [];217}218let edges_ = __modules__.query.Get(__params__.model, '_e', footprint_);219let edge_rays_ = __modules__.calc.Ray( __params__.model, edges_ );220for (let edge_ray_ of edge_rays_){221edge_ray_[pythonList(0, edge_ray_.length)] = [edge_ray_[pythonList(0, edge_ray_.length)][pythonList(0, edge_ray_[pythonList(0, edge_ray_.length)].length)], edge_ray_[pythonList(0, edge_ray_.length)][pythonList(1, edge_ray_[pythonList(0, edge_ray_.length)].length)], 0];222}223let front_ = await exec_Building_starter_node_549psa6t6a_getFront_(__params__, edges_, edge_rays_);224if (__params__.terminated) { return __params__.model;}225printFunc(__params__.console,'front', front_);226if (front_ == null){227return [];228}229let main_axis_ = await exec_Building_starter_node_549psa6t6a_mainAxis_(__params__, front_, edge_rays_);230if (__params__.terminated) { return __params__.model;}231if (main_axis_ == null){232return [];233}234let cross_axes_ = await exec_Building_starter_node_549psa6t6a_searchCrossAxes_(__params__, main_axis_, edge_rays_, 3, [0.1, Infinity, Infinity]);235if (__params__.terminated) { return __params__.model;}236if (cross_axes_ != null){237let next_ = cross_axes_[pythonList(2, cross_axes_.length)];238cross_axes_ = await exec_Building_starter_node_549psa6t6a_searchCrossAxes_(__params__, main_axis_, edge_rays_, 1, next_);239if (__params__.terminated) { return __params__.model;}240}241if (cross_axes_ != null){242let next_ = cross_axes_[pythonList(2, cross_axes_.length)];243cross_axes_ = await exec_Building_starter_node_549psa6t6a_searchCrossAxes_(__params__, main_axis_, edge_rays_, 0.2, next_);244if (__params__.terminated) { return __params__.model;}245}246if (cross_axes_ == null){247return [];248}249let bldg_dims_ = await exec_Building_starter_node_549psa6t6a_getBldgDims_(__params__, type_);250if (__params__.terminated) { return __params__.model;}251let start_ = await exec_Building_starter_node_549psa6t6a_getFrontStart_(__params__, front_, main_axis_[pythonList(0, main_axis_.length)], cross_axes_, bldg_dims_);252if (__params__.terminated) { return __params__.model;}253let mid_ = [main_axis_[pythonList(1, main_axis_.length)][pythonList(0, main_axis_[pythonList(1, main_axis_.length)].length)], main_axis_[pythonList(1, main_axis_.length)][pythonList(1, main_axis_[pythonList(1, main_axis_.length)].length)], 0];254let bldg_footprint_ = await exec_Building_starter_node_549psa6t6a_createBldgFootprint_(__params__, footprint_, start_, mid_, cross_axes_[pythonList(1, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(1, cross_axes_.length)].length)], bldg_dims_);255if (__params__.terminated) { return __params__.model;}256if (bldg_footprint_ == null){257return [];258}259__modules__.modify.Move( __params__.model, bldg_footprint_, [0, 0, 0.1] );260__modules__.attrib.Set(__params__.model, bldg_footprint_, 'type', type_ );261__modules__.attrib.Set(__params__.model, bldg_footprint_, 'class', "bldg_footprint" );262__modules__.attrib.Set(__params__.model, bldg_footprint_, 'max_floors', __modules__.attrib.Get(__params__.model, footprint_, 'max_floors') );263return [bldg_footprint_];264}265async function exec_Building_starter_node_549psa6t6a_createBldgAmen_(__params__, footprint_) {266let bldg_footprint_ = __modules__.make.Copy( __params__.model, footprint_, [0, 0, 0.05] );267__modules__.attrib.Set(__params__.model, bldg_footprint_, 'type', __modules__.attrib.Get(__params__.model, footprint_, 'type') );268__modules__.attrib.Set(__params__.model, bldg_footprint_, 'class', "bldg_footprint" );269__modules__.attrib.Set(__params__.model, bldg_footprint_, 'max_floors', __modules__.attrib.Get(__params__.model, footprint_, 'max_floors') );270return [bldg_footprint_];271}272async function exec_Building_starter_node_549psa6t6a_getFront_(__params__, edges_, edge_rays_) {273let fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "road_art");274if (len(fronts_) == 0){275fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "road_sec");276}277if (len(fronts_) == 0){278fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "road_loc");279}280if (len(fronts_) == 0){281fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "path");282}283if (len(fronts_) == 0){284fronts_ = __modules__.query.Filter(__params__.model, edges_, ['road', null], '==', "green");285}286if (len(fronts_) == 0){287fronts_ = [edges_[pythonList(0, edges_.length)]];288}289if (len(fronts_) > 1){290let lengths_ = __modules__.calc.Length( __params__.model, fronts_ );291fronts_ = listZip(listSort(listZip([fronts_, lengths_]), 1))[pythonList(0, listZip(listSort(listZip([fronts_, lengths_]), 1)).length)];292}293for (let edge_ray_ of edge_rays_){294edge_ray_[pythonList(0, edge_ray_.length)] = [edge_ray_[pythonList(0, edge_ray_.length)][pythonList(0, edge_ray_[pythonList(0, edge_ray_.length)].length)], edge_ray_[pythonList(0, edge_ray_.length)][pythonList(1, edge_ray_[pythonList(0, edge_ray_.length)].length)], 0];295}296let front_ = fronts_[pythonList(-1, fronts_.length)];297return front_;298}299async function exec_Building_starter_node_549psa6t6a_mainAxis_(__params__, front_, edge_rays_) {300let front_vec_ = __modules__.calc.Vector( __params__.model, front_ );301let front_cen_ = __modules__.calc.Centroid( __params__.model, front_, 'ps_average' );302front_cen_[pythonList(2, front_cen_.length)] = 0;303let vec_ = vecSetLen([-front_vec_[pythonList(1, front_vec_.length)], front_vec_[pythonList(0, front_vec_.length)], 0], 200);304let ray_ = rayLMove(rayMake(front_cen_, vec_), 0.1);305let isect_ = await exec_Building_starter_node_549psa6t6a__isect_(__params__, ray_, edge_rays_);306if (__params__.terminated) { return __params__.model;}307if (isect_ == null){308return null;309}310let depth_vec_ = vecFromTo(front_cen_, isect_[pythonList(0, isect_.length)]);311ray_ = rayMake(front_cen_, depth_vec_);312return ray_;313}314async function exec_Building_starter_node_549psa6t6a_searchCrossAxes_(__params__, main_axis_, edge_rays_, incr_, dist_min_leftright_) {315let dist_start_ = dist_min_leftright_[pythonList(0, dist_min_leftright_.length)];316let min_left_dist_ = dist_min_leftright_[pythonList(1, dist_min_leftright_.length)];317let min_right_dist_ = dist_min_leftright_[pythonList(2, dist_min_leftright_.length)];318let front_cen_ = main_axis_[pythonList(0, main_axis_.length)];319let depth_vec_ = main_axis_[pythonList(1, main_axis_.length)];320let right_vec_ = [depth_vec_[pythonList(1, depth_vec_.length)], -depth_vec_[pythonList(0, depth_vec_.length)], 0];321let max_area_ = 0;322let ray_left_ = null;323let ray_right_ = null;324let dist_end_ = vecLen(depth_vec_);325let dist_ = dist_start_;326while (dist_ < dist_end_){327let this_start_ = vecAdd(front_cen_, vecSetLen(depth_vec_, dist_));328let this_ray_left_ = rayMake(this_start_, vecSetLen(right_vec_, -100));329let this_ray_right_ = rayMake(this_start_, vecSetLen(right_vec_, 100));330let isect_left_ = await exec_Building_starter_node_549psa6t6a__isect_(__params__, this_ray_left_, edge_rays_);331if (__params__.terminated) { return __params__.model;}332let isect_right_ = await exec_Building_starter_node_549psa6t6a__isect_(__params__, this_ray_right_, edge_rays_);333if (__params__.terminated) { return __params__.model;}334if (isect_left_ == null || isect_right_ == null){335dist_ = dist_ + incr_;336continue;337}338this_ray_left_ = rayMake(this_start_, vecFromTo(this_start_, isect_left_[pythonList(0, isect_left_.length)]));339let this_left_dist_ = vecLen(this_ray_left_[pythonList(1, this_ray_left_.length)]);340if (this_left_dist_ < min_left_dist_){341min_left_dist_ = this_left_dist_;342}343else {344this_ray_left_[pythonList(1, this_ray_left_.length)] = vecSetLen(this_ray_left_[pythonList(1, this_ray_left_.length)], min_left_dist_);345}346this_ray_right_ = rayMake(this_start_, vecFromTo(this_start_, isect_right_[pythonList(0, isect_right_.length)]));347let this_right_dist_ = vecLen(this_ray_right_[pythonList(1, this_ray_right_.length)]);348if (this_right_dist_ < min_right_dist_){349min_right_dist_ = this_right_dist_;350}351else {352this_ray_right_[pythonList(1, this_ray_right_.length)] = vecSetLen(this_ray_right_[pythonList(1, this_ray_right_.length)], min_right_dist_);353}354let this_area_ = (vecLen(this_ray_left_[pythonList(1, this_ray_left_.length)]) + vecLen(this_ray_right_[pythonList(1, this_ray_right_.length)])) * dist_;355if (this_area_ > max_area_){356ray_left_ = this_ray_left_;357ray_right_ = this_ray_right_;358max_area_ = this_area_;359}360dist_ = dist_ + incr_;361}362let next_dist_start_ = dist_ - (2 * incr_);363if (next_dist_start_ < 0){364next_dist_start_ = dist_start_;365}366let next_dist_min_lr_ = [next_dist_start_, vecLen(ray_left_[pythonList(1, ray_left_.length)]), vecLen(ray_right_[pythonList(1, ray_right_.length)])];367if (ray_left_ == null || ray_right_ == null){368let chk_ = "rays are null";369}370return [ray_left_, ray_right_, next_dist_min_lr_];371}372async function exec_Building_starter_node_549psa6t6a_createRectMax_(__params__, main_axis_, cross_axes_) {373let xyz0_ = vecAdd(main_axis_[pythonList(0, main_axis_.length)], cross_axes_[pythonList(0, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(0, cross_axes_.length)].length)]);374let xyz1_ = vecAdd(main_axis_[pythonList(0, main_axis_.length)], cross_axes_[pythonList(1, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(1, cross_axes_.length)].length)]);375let xyz2_ = vecAdd(cross_axes_[pythonList(0, cross_axes_.length)][pythonList(0, cross_axes_[pythonList(0, cross_axes_.length)].length)], cross_axes_[pythonList(1, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(1, cross_axes_.length)].length)]);376let xyz3_ = vecAdd(cross_axes_[pythonList(0, cross_axes_.length)][pythonList(0, cross_axes_[pythonList(0, cross_axes_.length)].length)], cross_axes_[pythonList(0, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(0, cross_axes_.length)].length)]);377let posis_ = __modules__.make.Position( __params__.model, [xyz0_, xyz1_, xyz2_, xyz3_] );378let pline_ = __modules__.make.Polyline( __params__.model, posis_, 'close' );379return pline_;380}381async function exec_Building_starter_node_549psa6t6a_createBldgFootprint_(__params__, permis_footprint_, start_, vec_main_, vec_right_, bldg_dims_) {382let bldg_width_ = bldg_dims_[pythonList(0, bldg_dims_.length)];383let bldg_depth_ = bldg_dims_[pythonList(1, bldg_dims_.length)];384if (bldg_width_ == 0 || bldg_depth_ == 0){385return null;386}387let xyz1_ = vecAdd(start_, vecSetLen(vec_right_, bldg_width_));388let xyz2_ = vecAdd(xyz1_, vecSetLen(vec_main_, bldg_depth_));389let xyz3_ = vecAdd(xyz2_, vecSetLen(vec_right_, -bldg_width_));390let posis_ = __modules__.make.Position( __params__.model, [start_, xyz1_, xyz2_, xyz3_] );391let pgon_ = __modules__.make.Polygon( __params__.model, posis_ );392let trim_ = __modules__.poly2d.Boolean( __params__.model, pgon_, permis_footprint_, 'intersect' );393__modules__.modify.Delete( __params__.model, pgon_, 'delete_selected' );394return trim_;395}396async function exec_Building_starter_node_549psa6t6a_getPermisDims_(__params__, plot_type_) {397let plot_dims_ = __modules__.attrib.Get(__params__.model, null, 'plot_dims');398if (plot_type_ == "art_art"){399let w_ = plot_dims_["part_art_d"] - plot_dims_["sb_art_front"] - plot_dims_["sb_art_side"];400let d_ = w_;401return [w_, d_];402}403if (plot_type_ == "art_sec"){404let w_ = plot_dims_["part_sec_d"] - plot_dims_["sb_sec_front"] - plot_dims_["sb_art_side"];405let d_ = plot_dims_["part_art_d"] - plot_dims_["sb_art_front"] - plot_dims_["sb_sec_side"];406return [w_, d_];407}408if (plot_type_ == "art_loc"){409let w_ = plot_dims_["part_loc_d"] - plot_dims_["sb_loc_front"] - plot_dims_["sb_art_side"];410let d_ = plot_dims_["part_art_d"] - plot_dims_["sb_art_front"] - plot_dims_["sb_loc_side"];411return [w_, d_];412}413if (plot_type_ == "art"){414let w_ = plot_dims_["plot_art_w"] - (2 * plot_dims_["sb_art_side"]);415let d_ = plot_dims_["part_art_d"] - plot_dims_["sb_art_front"] - plot_dims_["sb_art_back"];416return [w_, d_];417}418if (plot_type_ == "sec_sec"){419let w_ = plot_dims_["part_sec_d"] - plot_dims_["sb_sec_front"] - plot_dims_["sb_sec_side"];420let d_ = w_;421return [w_, d_];422}423if (plot_type_ == "sec_loc"){424let w_ = plot_dims_["part_loc_d"] - plot_dims_["sb_loc_front"] - plot_dims_["sb_sec_side"];425let d_ = plot_dims_["part_sec_d"] - plot_dims_["sb_sec_front"] - plot_dims_["sb_loc_side"];426return [w_, d_];427}428if (plot_type_ == "sec"){429let w_ = plot_dims_["plot_sec_w"] - (2 * plot_dims_["sb_sec_side"]);430let d_ = plot_dims_["part_sec_d"] - plot_dims_["sb_sec_front"] - plot_dims_["sb_sec_back"];431return [w_, d_];432}433if (plot_type_ == "loc_loc"){434let w_ = plot_dims_["part_loc_d"] - plot_dims_["sb_loc_front"] - plot_dims_["sb_loc_side"];435let d_ = w_;436return [w_, d_];437}438if (plot_type_ == "loc"){439let w_ = plot_dims_["plot_loc_w"] - (2 * plot_dims_["sb_loc_side"]);440let d_ = plot_dims_["part_loc_d"] - plot_dims_["sb_loc_front"] - plot_dims_["sb_loc_back"];441return [w_, d_];442}443if (plot_type_ == "off_grid0" || plot_type_ == "off_grid1"){444let w_ = plot_dims_["plot_og_w"] - (2 * plot_dims_["sb_og_side"]);445let d_ = plot_dims_["plot_og_d"] - plot_dims_["sb_og_front"] - plot_dims_["sb_og_back"];446return [w_, d_];447}448if (plot_type_ == "off_grid2"){449let w_ = plot_dims_["plot_og2_w"] - (2 * plot_dims_["sb_og_side"]);450let d_ = plot_dims_["plot_og2_d"] - plot_dims_["sb_og_front"] - plot_dims_["sb_og_back"];451return [w_, d_];452}453let type_not_found_ = plot_type_;454return [0, 0];455}456async function exec_Building_starter_node_549psa6t6a_getBldgParams_(__params__, plot_type_) {457let result_ = [0, 0, 0];458if (plot_type_ == "art_art"){459return [pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_];460}461if (plot_type_ == "art_sec"){462return [pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_];463}464if (plot_type_ == "art_loc"){465return [pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_];466}467if (plot_type_ == "art"){468return [pcen_art_w_, pcen_art_d_, pcen_art_f_];469}470if (plot_type_ == "sec_sec"){471return [pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_];472}473if (plot_type_ == "sec_loc"){474return [pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_];475}476if (plot_type_ == "sec"){477return [pcen_sec_w_, pcen_sec_d_, pcen_sec_f_];478}479if (plot_type_ == "loc_loc"){480return [pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_];481}482if (plot_type_ == "loc"){483return [pcen_loc_w_, pcen_loc_d_, pcen_loc_f_];484}485if (plot_type_ == "off_grid2"){486return [pcen_og2_w_, pcen_og2_d_, pcen_og2_f_];487}488if (strStarts(plot_type_, "off")){489return [pcen_og_w_, pcen_og_d_, pcen_og_f_];490}491return result_;492}493async function exec_Building_starter_node_549psa6t6a_getBldgDims_(__params__, plot_type_) {494let result_ = await exec_Building_starter_node_549psa6t6a_getPermisDims_(__params__, plot_type_);495if (__params__.terminated) { return __params__.model;}496let w_ = result_[pythonList(0, result_.length)];497let d_ = result_[pythonList(1, result_.length)];498result_ = await exec_Building_starter_node_549psa6t6a_getBldgParams_(__params__, plot_type_);499if (__params__.terminated) { return __params__.model;}500let pcen_w_ = result_[pythonList(0, result_.length)];501let pcen_d_ = result_[pythonList(1, result_.length)];502return [w_ * (pcen_w_ / 100), d_ * (pcen_d_ / 100)];503}504async function exec_Building_starter_node_549psa6t6a_getFrontStart_(__params__, front_, mid_, cross_axes_, bldg_dims_) {505let bldg_w_ = bldg_dims_[pythonList(0, bldg_dims_.length)];506let verts_ = __modules__.query.Get(__params__.model, '_v', front_);507let next_edge_ = __modules__.query.Get(__params__.model, '_e', verts_[pythonList(1, verts_.length)])[pythonList(1, __modules__.query.Get(__params__.model, '_e', verts_[pythonList(1, verts_.length)]).length)];508let next_type_ = __modules__.attrib.Get(__params__.model, next_edge_, 'road');509let next_len_ = __modules__.calc.Length( __params__.model, next_edge_ );510let corner_ = 0;511if (next_len_ > 0.2 && next_type_){512if (strStarts(next_type_, "road")){513corner_ = 1;514}515else {516if(strStarts(next_type_, "entr")){517corner_ = 1;518}519else {520if(next_type_ == "green" || next_type_ == "path"){521corner_ = 1;522}523}524}525}526let front_len_ = __modules__.calc.Length( __params__.model, front_ );527let front_xyzs_ = __modules__.attrib.Get(__params__.model, __modules__.query.Get(__params__.model, 'ps', verts_), 'xyz');528let front_left_ = front_xyzs_[pythonList(0, front_xyzs_.length)];529let front_right_ = front_xyzs_[pythonList(1, front_xyzs_.length)];530let cross_left_ = vecAdd(mid_, cross_axes_[pythonList(0, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(0, cross_axes_.length)].length)]);531let cross_right_ = vecAdd(mid_, cross_axes_[pythonList(1, cross_axes_.length)][pythonList(1, cross_axes_[pythonList(1, cross_axes_.length)].length)]);532let vec_left_ = vecNorm(vecFromTo(mid_, front_left_));533let vec_right_ = vecNorm(vecFromTo(mid_, front_right_));534let dist_to_c_left_ = vecDot(vecFromTo(mid_, cross_left_), vec_left_);535let dist_to_c_right_ = vecDot(vecFromTo(mid_, cross_right_), vec_right_);536let dist_to_f_left_ = vecDot(vecFromTo(mid_, front_left_), vec_left_);537let dist_to_f_right_ = vecDot(vecFromTo(mid_, front_right_), vec_right_);538let olap_left_ = front_left_;539let olap_right_ = front_right_;540if (dist_to_c_left_ < dist_to_f_left_){541olap_left_ = cross_left_;542}543if (dist_to_c_right_ < dist_to_f_right_){544olap_right_ = cross_right_;545}546let len_overlap_ = distance(olap_left_, olap_right_);547if (corner_ == 0 && bldg_w_ < len_overlap_){548return olap_left_;549}550if (corner_ == 1 && bldg_w_ < len_overlap_){551return vecAdd(olap_right_, vecSetLen(vec_left_, bldg_w_));552}553let len_olap_left_cross_right_ = distance(olap_left_, cross_right_);554if (corner_ == 0 && bldg_w_ < len_olap_left_cross_right_){555return olap_left_;556}557let len_cross_left_olap_right_ = distance(cross_left_, olap_right_);558if (corner_ == 1 && bldg_w_ < len_cross_left_olap_right_){559return vecAdd(olap_right_, vecSetLen(vec_left_, bldg_w_));560}561if (bldg_w_ < len_olap_left_cross_right_){562return olap_left_;563}564if (bldg_w_ < len_cross_left_olap_right_){565return vecAdd(olap_right_, vecSetLen(vec_left_, bldg_w_));566}567if (bldg_w_ < distance(cross_left_, cross_right_)){568return cross_left_;569}570return front_left_;571}572async function exec_Building_starter_node_549psa6t6a__isect_(__params__, ray_, rays_) {573for (let i_ of range(len(rays_))){574let a_ray_ = rays_[pythonList(i_, rays_.length)];575let isect_ = intersect(ray_, a_ray_, 0);576if (isect_ != null){577return [isect_, i_];578}579}580return null;581}582async function exec_Building_starter_node_549psa6t6a(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){583while (true) {584__modules__._model.__preprocess__( __params__.model);585let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "max_footprint");586for (let footprint_ of footprints_){587if (strEnds( __modules__.attrib.Get(__params__.model, footprint_, 'type'), "am")){588let am_bldg_footprints_ = await exec_Building_starter_node_549psa6t6a_createBldgAmen_(__params__, footprint_);589if (__params__.terminated) { return __params__.model;}590}591else {592let bldg_footprints_ = await exec_Building_starter_node_549psa6t6a_createBldg_(__params__, footprint_);593if (__params__.terminated) { return __params__.model;}594}595}596__modules__.modify.Delete( __params__.model, footprints_, 'delete_selected' );597__modules__._model.__postprocess__( __params__.model);598break; }599return __params__.model;600}601async function exec_Building_starter_node_dn467r9w96k_getNumFloors_(__params__, footprint_, plot_type_) {602if (strEnds(plot_type_, "_am")){603plot_type_ = plot_type_.slice(0,-3);604}605let pcen_floors_ = await exec_Building_starter_node_dn467r9w96k__getBldgParams_(__params__, plot_type_);606if (__params__.terminated) { return __params__.model;}607let max_floors_ = __modules__.attrib.Get(__params__.model, footprint_, 'max_floors');608return ceil(max_floors_ * (pcen_floors_ / 100));609}610async function exec_Building_starter_node_dn467r9w96k__getBldgParams_(__params__, plot_type_) {611let result_ = 0;612if (plot_type_ == "art_art"){613return pcen_art_art_f_;614}615if (plot_type_ == "art_sec"){616return pcen_art_sec_f_;617}618if (plot_type_ == "art_loc"){619return pcen_art_loc_f_;620}621if (plot_type_ == "art"){622return pcen_art_f_;623}624if (plot_type_ == "sec_sec"){625return pcen_sec_sec_f_;626}627if (plot_type_ == "sec_loc"){628return pcen_sec_loc_f_;629}630if (plot_type_ == "sec"){631return pcen_sec_f_;632}633if (plot_type_ == "loc_loc"){634return pcen_loc_loc_f_;635}636if (plot_type_ == "loc"){637return pcen_loc_f_;638}639if (plot_type_ == "off_grid2"){640return pcen_og2_f_;641}642if (strStarts(plot_type_, "off")){643return pcen_og_f_;644}645return result_;646}647async function exec_Building_starter_node_dn467r9w96k(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){648while (true) {649__modules__._model.__preprocess__( __params__.model);650let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_footprint");651for (let footprint_ of footprints_){652let type_ = __modules__.attrib.Get(__params__.model, footprint_, 'type');653let num_floors_ = await exec_Building_starter_node_dn467r9w96k_getNumFloors_(__params__, footprint_, type_);654if (__params__.terminated) { return __params__.model;}655if (num_floors_ > 0){656let bldg_ = __modules__.make.Extrude( __params__.model, footprint_, num_floors_ * 3, num_floors_, 'quads' );657__modules__.attrib.Set(__params__.model, bldg_, 'type', type_ );658__modules__.attrib.Set(__params__.model, bldg_.slice(0,-1), 'class', "bldg_facade" );659__modules__.attrib.Set(__params__.model, bldg_[pythonList(-1, bldg_.length)], 'class', "bldg_roof" );660}661}662__modules__._model.__postprocess__( __params__.model);663break; }664return __params__.model;665}666async function exec_Building_starter_node_8lrb9z2ypba_applyColours_(__params__, colors_dict_, pgons_) {667let pgons_lists_ = {};668let cols_ = {};669let keys_ = [];670for (let pgon_ of pgons_){671let type_ = __modules__.attrib.Get(__params__.model, pgon_, 'type');672let col_ = colors_dict_[pythonList(type_, colors_dict_.length)];673if (col_ != undefined){674let key_ = string(col_);675let pgons_list_ = pgons_lists_[pythonList(key_, pgons_lists_.length)];676if (pgons_list_ == undefined){677pgons_list_ = [];678pgons_lists_[pythonList(key_, pgons_lists_.length)] = pgons_list_;679cols_[pythonList(key_, cols_.length)] = col_;680__modules__.list.Add( keys_, key_, 'to_end' );681}682__modules__.list.Add( pgons_list_, pgon_, 'to_end' );683}684}685for (let key_ of keys_){686pgons_ = pgons_lists_[pythonList(key_, pgons_lists_.length)];687let col_ = cols_[pythonList(key_, cols_.length)];688__modules__.visualize.Color( __params__.model, pgons_, col_ );689}690}691async function exec_Building_starter_node_8lrb9z2ypba(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){692while (true) {693__modules__._model.__preprocess__( __params__.model);694let colors_dict_land_ = {};695colors_dict_land_["art_art"] = [0.8, 0.51, 0.48];696colors_dict_land_["art_sec"] = [0.85, 0.62, 0.6];697colors_dict_land_["art_loc"] = [0.9, 0.73, 0.72];698colors_dict_land_["art"] = [0.92, 0.79, 0.78];699colors_dict_land_["sec_sec"] = [0.98, 0.81, 0.69];700colors_dict_land_["sec_loc"] = [0.98, 0.86, 0.78];701colors_dict_land_["sec"] = [0.98, 0.91, 0.86];702colors_dict_land_["loc_loc"] = [0.98, 0.92, 0.73];703colors_dict_land_["loc"] = [0.98, 0.95, 0.83];704colors_dict_land_["entr0"] = [1, 0.98, 0.92];705colors_dict_land_["entr1"] = [1, 0.98, 0.92];706colors_dict_land_["off_grid"] = [0.81, 0.9, 0.95];707colors_dict_land_["off_grid0"] = [0.81, 0.9, 0.95];708colors_dict_land_["off_grid1"] = [0.68, 0.83, 0.9];709colors_dict_land_["off_grid2"] = [0.68, 0.83, 0.9];710colors_dict_land_["path0"] = [0.93, 1, 0.9];711colors_dict_land_["path1"] = [0.93, 1, 0.9];712colors_dict_land_["path2"] = [0.93, 1, 0.9];713colors_dict_land_["green0"] = [0.86, 0.95, 0.81];714colors_dict_land_["green1"] = [0.86, 0.95, 0.81];715colors_dict_land_["green2"] = [0.86, 0.95, 0.81];716colors_dict_land_["off_grid0_os"] = [0.75, 0.9, 0.67];717colors_dict_land_["off_grid1_os"] = [0.75, 0.9, 0.67];718colors_dict_land_["off_grid2_os"] = [0.75, 0.9, 0.67];719colors_dict_land_["loc_os"] = [0.75, 0.9, 0.67];720colors_dict_land_["loc_loc_os"] = [0.75, 0.9, 0.67];721colors_dict_land_["sec_os"] = [0.75, 0.9, 0.67];722colors_dict_land_["sec_loc_os"] = [0.75, 0.9, 0.67];723colors_dict_land_["sec_sec_os"] = [0.75, 0.9, 0.67];724colors_dict_land_["corner_park"] = [0.75, 0.9, 0.67];725colors_dict_land_["off_grid0_am"] = [0.85, 0.6, 0.66];726colors_dict_land_["off_grid1_am"] = [0.85, 0.6, 0.66];727colors_dict_land_["off_grid2_am"] = [0.85, 0.6, 0.66];728colors_dict_land_["loc_am"] = [0.85, 0.6, 0.66];729colors_dict_land_["loc_loc_am"] = [0.85, 0.6, 0.66];730colors_dict_land_["sec_am"] = [0.85, 0.6, 0.66];731colors_dict_land_["sec_loc_am"] = [0.85, 0.6, 0.66];732colors_dict_land_["sec_sec_am"] = [0.85, 0.6, 0.66];733colors_dict_land_["off_grid_too_small"] = [1, 0.7, 1];734colors_dict_land_["too_deep"] = [1, 0.7, 1];735colors_dict_land_["concave_corner"] = [1, 0.7, 1];736colors_dict_land_["leftover"] = [1, 0.7, 1];737let colors_dict_bldg_ = {};738colors_dict_bldg_["art_art"] = [0.8, 0.18, 0.12];739colors_dict_bldg_["art_sec"] = [0.85, 0.3, 0.25];740colors_dict_bldg_["art_loc"] = [0.9, 0.48, 0.45];741colors_dict_bldg_["art"] = [0.93, 0.59, 0.56];742colors_dict_bldg_["sec_sec"] = [0.98, 0.55, 0.24];743colors_dict_bldg_["sec_loc"] = [0.98, 0.65, 0.44];744colors_dict_bldg_["sec"] = [0.98, 0.75, 0.59];745colors_dict_bldg_["loc_loc"] = [0.98, 0.83, 0.34];746colors_dict_bldg_["loc"] = [0.98, 0.89, 0.59];747colors_dict_bldg_["off_grid"] = [0.54, 0.78, 0.9];748colors_dict_bldg_["off_grid0"] = [0.54, 0.78, 0.9];749colors_dict_bldg_["off_grid1"] = [0.54, 0.78, 0.9];750colors_dict_bldg_["off_grid2"] = [0.36, 0.66, 0.8];751colors_dict_bldg_["off_grid0_am"] = [0.75, 0.38, 0.47];752colors_dict_bldg_["off_grid1_am"] = [0.75, 0.38, 0.47];753colors_dict_bldg_["off_grid2_am"] = [0.75, 0.38, 0.47];754colors_dict_bldg_["loc_am"] = [0.75, 0.38, 0.47];755colors_dict_bldg_["loc_loc_am"] = [0.75, 0.38, 0.47];756colors_dict_bldg_["sec_am"] = [0.75, 0.38, 0.47];757colors_dict_bldg_["sec_loc_am"] = [0.75, 0.38, 0.47];758colors_dict_bldg_["sec_sec_am"] = [0.75, 0.38, 0.47];759let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_footprint");760let facades_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_facade");761let roofs_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_roof");762await exec_Building_starter_node_8lrb9z2ypba_applyColours_(__params__, colors_dict_bldg_, listFlat([footprints_, facades_, roofs_]));763if (__params__.terminated) { return __params__.model;}764__modules__._model.__postprocess__( __params__.model);765break; }766return __params__.model;767}768async function exec_Building_starter_node_4fznbcf45t_tree4half_(__params__, height_) {769let height_step_ = height_ / 6;770let width_ = (height_ / 3);771let width_step_ = width_ / 6;772let xyz0_ = [0, 0, 0];773let xyz1_ = [0.25, 0, 0];774let xyz2_ = [0.15, 0, height_step_ * 2];775let xyz3_ = [width_step_ * 3, 0, height_step_ * 3];776let xyz4_ = [width_, 0, height_step_ * 4];777let xyz5_ = [width_step_ * 3, 0, height_step_ * 5];778let xyz6_ = [0, 0, height_];779let xyzs_ = [xyz0_, xyz1_, xyz2_, xyz3_, xyz4_, xyz5_, xyz6_];780let mirror_ = [];781for (let i_ of range(0, len(xyzs_))){782if (i_ > 0 && i_ < len(xyzs_) - 1){783let xyzs_mirror_ = [xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] * -1, 0, xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)]];784__modules__.list.Add( mirror_, xyzs_mirror_, 'to_start' );785}786}787xyzs_ = listJoin(xyzs_, mirror_);788for (let i_ of range(0, len(xyzs_))){789if (i_ > 2 && i_ < len(xyzs_) - 2 && i_ != 6){790xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)] = xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)] + rand(-height_step_, height_step_);791xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] = xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] + rand(-width_step_, width_step_);792}793}794return xyzs_;795}796async function exec_Building_starter_node_4fznbcf45t_tree4_(__params__, posi_, height_) {797let all_xyzs_ = [];798let cen_ = __modules__.attrib.Get(__params__.model, posi_, 'xyz');799let pln_ = [cen_, [1, 0, 0], [0, 1, 0]];800pln_ = plnLRotZ(pln_, JSON.parse(JSON.stringify(PI)) * rand(0, 1));801let height_step_ = height_ / 6;802height_ = height_ + rand(-height_step_, height_step_);803for (let i_ of range(2)){804pln_ = plnLRotZ(pln_, (JSON.parse(JSON.stringify(PI)) / 2) * i_);805let xyzs_ = await exec_Building_starter_node_4fznbcf45t_tree4half_(__params__, height_);806if (__params__.terminated) { return __params__.model;}807let xyzs2_ = vecGtoL(xyzs_, pln_);808__modules__.list.Add( all_xyzs_, xyzs2_, 'to_end' );809}810let posis_ = __modules__.make.Position( __params__.model, all_xyzs_ );811let canopy_ = __modules__.make.Polygon( __params__.model, posis_ );812return canopy_;813}814async function exec_Building_starter_node_4fznbcf45t(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){815while (true) {816__modules__._model.__preprocess__( __params__.model);817let trees_ = [];818if (__modules__.attrib.Get(__params__.model, null, 'add_trees')){819let tree_pts_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pt', null), ['type', null], '==', "tree");820for (let tree_pt_ of tree_pts_){821let tree_ = await exec_Building_starter_node_4fznbcf45t_tree4_(__params__, __modules__.query.Get(__params__.model, 'ps', tree_pt_)[pythonList(0, __modules__.query.Get(__params__.model, 'ps', tree_pt_).length)], __modules__.attrib.Get(__params__.model, null, 'tree_height_start'));822if (__params__.terminated) { return __params__.model;}823__modules__.list.Add( trees_, tree_, 'extend_end' );824}825}826__modules__.visualize.Color( __params__.model, trees_, [0.5, 1, 0.5] );827__modules__._model.__postprocess__( __params__.model);828break; }829return __params__.model;830}831async function exec_Building_starter_node_7gepyjg285l(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){832while (true) {833__modules__._model.__preprocess__( __params__.model);834let data_ = {};835data_["param_pcen_art_art_w"] = pcen_art_art_w_;836data_["param_pcen_art_sec_w"] = pcen_art_sec_w_;837data_["param_pcen_art_loc_w"] = pcen_art_loc_w_;838data_["param_pcen_art_w"] = pcen_art_w_;839data_["param_pcen_sec_sec_w"] = pcen_sec_sec_w_;840data_["param_pcen_sec_loc_w"] = pcen_sec_loc_w_;841data_["param_pcen_sec_w"] = pcen_sec_w_;842data_["param_pcen_loc_loc_w"] = pcen_loc_loc_w_;843data_["param_pcen_loc_w"] = pcen_loc_w_;844data_["param_pcen_og_w"] = pcen_og_w_;845data_["param_pcen_og2_w"] = pcen_og2_w_;846data_["param_pcen_art_art_d"] = pcen_art_art_d_;847data_["param_pcen_art_sec_d"] = pcen_art_sec_d_;848data_["param_pcen_art_loc_d"] = pcen_art_loc_d_;849data_["param_pcen_art_d"] = pcen_art_d_;850data_["param_pcen_sec_sec_d"] = pcen_sec_sec_d_;851data_["param_pcen_sec_loc_d"] = pcen_sec_loc_d_;852data_["param_pcen_sec_d"] = pcen_sec_d_;853data_["param_pcen_loc_loc_d"] = pcen_loc_loc_d_;854data_["param_pcen_loc_d"] = pcen_loc_d_;855data_["param_pcen_og_d"] = pcen_og_d_;856data_["param_pcen_og2_d"] = pcen_og2_d_;857data_["param_pcen_art_art_f"] = pcen_art_art_f_;858data_["param_pcen_art_sec_f"] = pcen_art_sec_f_;859data_["param_pcen_art_loc_f"] = pcen_art_loc_f_;860data_["param_pcen_art_f"] = pcen_art_f_;861data_["param_pcen_sec_sec_f"] = pcen_sec_sec_f_;862data_["param_pcen_sec_loc_f"] = pcen_sec_loc_f_;863data_["param_pcen_sec_f"] = pcen_sec_f_;864data_["param_pcen_loc_loc_f"] = pcen_loc_loc_f_;865data_["param_pcen_loc_f"] = pcen_loc_f_;866data_["param_pcen_og_f"] = pcen_og_f_;867data_["param_pcen_og2_f"] = pcen_og2_f_;868let __return_value__ = __modules__._Output.Return(__params__.model, data_);869return __return_value__;870break; }871}872var merged;873console.log("Executing Node: Start");874let result_exec_Building_starter_node_w5xf0jmbotm = __params__.model;875console.log("Executing Node: import");876__params__.model = result_exec_Building_starter_node_w5xf0jmbotm;877let result_exec_Building_starter_node_wz73f8oew4 = await exec_Building_starter_node_wz73f8oew4(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);878console.log("Executing Node: gen footprints by axes");879__params__.model = result_exec_Building_starter_node_wz73f8oew4;880let result_exec_Building_starter_node_549psa6t6a = await exec_Building_starter_node_549psa6t6a(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);881console.log("Executing Node: floors");882__params__.model = result_exec_Building_starter_node_549psa6t6a;883let result_exec_Building_starter_node_dn467r9w96k = await exec_Building_starter_node_dn467r9w96k(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);884console.log("Executing Node: colors");885__params__.model = result_exec_Building_starter_node_dn467r9w96k;886let result_exec_Building_starter_node_8lrb9z2ypba = await exec_Building_starter_node_8lrb9z2ypba(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);887console.log("Executing Node: trees");888__params__.model = result_exec_Building_starter_node_8lrb9z2ypba;889let result_exec_Building_starter_node_4fznbcf45t = await exec_Building_starter_node_4fznbcf45t(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);890console.log("Executing Node: End");891__params__.model = result_exec_Building_starter_node_4fznbcf45t;892let result_exec_Building_starter_node_7gepyjg285l = await exec_Building_starter_node_7gepyjg285l(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);893return result_exec_Building_starter_node_7gepyjg285l;894}895function pythonList(x, l){896 if (x < 0) {897 return x + l;898 }899 return x;900}901function mergeInputs(models){902 let result = null;903 if (models.length === 0) {904 result = __modules__._model.__new__();905 } else if (models.length === 1) {906 result = models[0].clone();907 } else {908 result = models[0].clone();909 for (let i = 1; i < models.length; i++) {910 __modules__._model.__merge__(result, models[i]);911 }912 }913 try {914 result.debug = __debug__;915 } catch (ex) {}916 return result;917}918function duplicateModel(model){919 const result = model.clone();920 try {921 result.debug = __debug__;922 } catch (ex) {}923 return result;924}925function printFunc(_console, name, value){926 let val;927 if (!value) {928 val = value;929 } else if (value === '__null__') {930 console.log('_ ' + name);931 return value;932 } else if (typeof value === 'number' || value === undefined) {933 val = value;934 } else if (typeof value === 'string') {935 val = value;936 } else if (value.constructor === [].constructor) {937 let __list_check__ = false;938 let __value_strings__ = [];939 for (const __item__ of value) {940 if (!__item__) {941 __value_strings__.push('' + __item__);942 continue;943 }944 if (__item__.constructor === [].constructor || __item__.constructor === {}.constructor) {945 __list_check__ = true;946 }947 __value_strings__.push(JSON.stringify(__item__).replace(/,/g, ', '));948 }949 if (__list_check__) {950 val = '[\n' + __value_strings__.join(',\n') + '\n]';951 } else {952 val = '[' + __value_strings__.join(', ') + ']';953 }954 } else if (value.constructor === {}.constructor) {955 let __list_check__ = false;956 let __value_strings__ = [];957 for (const __item__ in value) {958 const __value__ = value[__item__];959 if (!__value__) {960 __value_strings__.push( __item__ + ': ' + __value__);961 continue;962 }963 if (__value__.constructor === [].constructor || __value__.constructor === {}.constructor) {964 __list_check__ = true;965 }966 __value_strings__.push(__item__ + ': ' + JSON.stringify(__value__).replace(/,/g, ', '));967 }968 if (__list_check__) {969 val = '{\n' + __value_strings__.join(',\n') + '\n}';970 } else {971 val = '{' + __value_strings__.join(', ') + '}';972 }973 } else {974 val = value;975 }976 // console.log(name + ' = ' + val);977 return val;978}979function printInp(pcen_art_art_w,pcen_art_art_d,pcen_art_art_f,pcen_art_sec_w,pcen_art_sec_d,pcen_art_sec_f,pcen_art_loc_w,pcen_art_loc_d,pcen_art_loc_f,pcen_art_w,pcen_art_d,pcen_art_f,pcen_sec_sec_w,pcen_sec_sec_d,pcen_sec_sec_f,pcen_sec_loc_w,pcen_sec_loc_d,pcen_sec_loc_f,pcen_sec_w,pcen_sec_d,pcen_sec_f,pcen_loc_loc_w,pcen_loc_loc_d,pcen_loc_loc_f,pcen_loc_w,pcen_loc_d,pcen_loc_f,pcen_og_w,pcen_og_d,pcen_og_f,pcen_og2_w,pcen_og2_d,pcen_og2_f){980console.log("Calling function Building_starter() with the following arguments:\n" +981" pcen_art_art_w = " + pcen_art_art_w + "\n" +982" pcen_art_art_d = " + pcen_art_art_d + "\n" +983" pcen_art_art_f = " + pcen_art_art_f + "\n" +984" pcen_art_sec_w = " + pcen_art_sec_w + "\n" +985" pcen_art_sec_d = " + pcen_art_sec_d + "\n" +986" pcen_art_sec_f = " + pcen_art_sec_f + "\n" +987" pcen_art_loc_w = " + pcen_art_loc_w + "\n" +988" pcen_art_loc_d = " + pcen_art_loc_d + "\n" +989" pcen_art_loc_f = " + pcen_art_loc_f + "\n" +990" pcen_art_w = " + pcen_art_w + "\n" +991" pcen_art_d = " + pcen_art_d + "\n" +992" pcen_art_f = " + pcen_art_f + "\n" +993" pcen_sec_sec_w = " + pcen_sec_sec_w + "\n" +994" pcen_sec_sec_d = " + pcen_sec_sec_d + "\n" +995" pcen_sec_sec_f = " + pcen_sec_sec_f + "\n" +996" pcen_sec_loc_w = " + pcen_sec_loc_w + "\n" +997" pcen_sec_loc_d = " + pcen_sec_loc_d + "\n" +998" pcen_sec_loc_f = " + pcen_sec_loc_f + "\n" +999" pcen_sec_w = " + pcen_sec_w + "\n" +1000" pcen_sec_d = " + pcen_sec_d + "\n" +1001" pcen_sec_f = " + pcen_sec_f + "\n" +1002" pcen_loc_loc_w = " + pcen_loc_loc_w + "\n" +1003" pcen_loc_loc_d = " + pcen_loc_loc_d + "\n" +1004" pcen_loc_loc_f = " + pcen_loc_loc_f + "\n" +1005" pcen_loc_w = " + pcen_loc_w + "\n" +1006" pcen_loc_d = " + pcen_loc_d + "\n" +1007" pcen_loc_f = " + pcen_loc_f + "\n" +1008" pcen_og_w = " + pcen_og_w + "\n" +1009" pcen_og_d = " + pcen_og_d + "\n" +1010" pcen_og_f = " + pcen_og_f + "\n" +1011" pcen_og2_w = " + pcen_og2_w + "\n" +1012" pcen_og2_d = " + pcen_og2_d + "\n" +1013" pcen_og2_f = " + pcen_og2_f + "\n" +1014'')};1015// printInp(pcen_art_art_w,pcen_art_art_d,pcen_art_art_f,pcen_art_sec_w,pcen_art_sec_d,pcen_art_sec_f,pcen_art_loc_w,pcen_art_loc_d,pcen_art_loc_f,pcen_art_w,pcen_art_d,pcen_art_f,pcen_sec_sec_w,pcen_sec_sec_d,pcen_sec_sec_f,pcen_sec_loc_w,pcen_sec_loc_d,pcen_sec_loc_f,pcen_sec_w,pcen_sec_d,pcen_sec_f,pcen_loc_loc_w,pcen_loc_loc_d,pcen_loc_loc_f,pcen_loc_w,pcen_loc_d,pcen_loc_f,pcen_og_w,pcen_og_d,pcen_og_f,pcen_og2_w,pcen_og2_d,pcen_og2_f);1016const __params__ = {};1017__params__["model"] = __modules__._model.__new__();1018if (__model__) {1019__modules__.io._importGI(__params__["model"], __model__);1020}1021__params__["model"].debug = __debug__;1022__params__["console"] = [];1023__params__["modules"] = __modules__;1024const result = await exec_Building_starter(__params__, pcen_art_art_w, pcen_art_art_d, pcen_art_art_f, pcen_art_sec_w, pcen_art_sec_d, pcen_art_sec_f, pcen_art_loc_w, pcen_art_loc_d, pcen_art_loc_f, pcen_art_w, pcen_art_d, pcen_art_f, pcen_sec_sec_w, pcen_sec_sec_d, pcen_sec_sec_f, pcen_sec_loc_w, pcen_sec_loc_d, pcen_sec_loc_f, pcen_sec_w, pcen_sec_d, pcen_sec_f, pcen_loc_loc_w, pcen_loc_loc_d, pcen_loc_loc_f, pcen_loc_w, pcen_loc_d, pcen_loc_f, pcen_og_w, pcen_og_d, pcen_og_f, pcen_og2_w, pcen_og2_d, pcen_og2_f);1025if (result === __params__.model) { return { "model": __params__.model, "result": null };}1026return {"model": __params__.model, "result": result};1027/** * **/1028}...
building_max.js
Source:building_max.js
1/**2 * to use this code: import Building_max from this js file as well as the GI module3 * run Building_max with the GI module as input along with other start node input4 * e.g.:5 * const Building_max = require('./Building_max.js').Building_max6 * const module = require('gi-module')7 * const result = await Building_max(module, start_input_1, start_input_2, ...);8 *9 * returns: a json object:10 * _ result.model -> gi model of the flowchart11 * _ result.result -> returned output of the flowchart, if the flowchart does not return any value, result.result is the model of the flowchart12 */13// Parameter: {"name":"in_model","value":"''","type":0}14// Parameter: {"name":"pcen_art_art_w","value":"0","type":1,"min":"0","max":"100","step":"1"}15// Parameter: {"name":"pcen_art_art_d","value":"0","type":1,"min":"0","max":"100","step":"1"}16// Parameter: {"name":"pcen_art_art_f","value":"0","type":1,"min":"0","max":"100","step":"1"}17// Parameter: {"name":"pcen_art_sec_w","value":"0","type":1,"min":"0","max":"100","step":"1"}18// Parameter: {"name":"pcen_art_sec_d","value":"0","type":1,"min":"0","max":"100","step":"1"}19// Parameter: {"name":"pcen_art_sec_f","value":"0","type":1,"min":"0","max":"100","step":"1"}20// Parameter: {"name":"pcen_art_loc_w","value":0,"type":1,"min":"0","max":"100","step":"1"}21// Parameter: {"name":"pcen_art_loc_d","value":0,"type":1,"min":"0","max":"100","step":"1"}22// Parameter: {"name":"pcen_art_loc_f","value":0,"type":1,"min":"0","max":"100","step":"1"}23// Parameter: {"name":"pcen_art_w","value":"100","type":1,"min":"0","max":"100","step":"1"}24// Parameter: {"name":"pcen_art_d","value":"60","type":1,"min":"0","max":"100","step":"1"}25// Parameter: {"name":"pcen_art_f","value":"80","type":1,"min":"0","max":"100","step":"1"}26// Parameter: {"name":"pcen_sec_sec_w","value":"0","type":1,"min":"0","max":"100","step":"1"}27// Parameter: {"name":"pcen_sec_sec_d","value":"0","type":1,"min":"0","max":"100","step":"1"}28// Parameter: {"name":"pcen_sec_sec_f","value":"0","type":1,"min":"0","max":"100","step":"1"}29// Parameter: {"name":"pcen_sec_loc_w","value":"0","type":1,"min":"0","max":"100","step":"1"}30// Parameter: {"name":"pcen_sec_loc_d","value":"0","type":1,"min":"0","max":"100","step":"1"}31// Parameter: {"name":"pcen_sec_loc_f","value":"0","type":1,"min":"0","max":"100","step":"1"}32// Parameter: {"name":"pcen_sec_w","value":"100","type":1,"min":"0","max":"100","step":"1"}33// Parameter: {"name":"pcen_sec_d","value":"70","type":1,"min":"0","max":"100","step":"1"}34// Parameter: {"name":"pcen_sec_f","value":"80","type":1,"min":"0","max":"100","step":"1"}35// Parameter: {"name":"pcen_loc_loc_w","value":"100","type":1,"min":"0","max":"100","step":"1"}36// Parameter: {"name":"pcen_loc_loc_d","value":"100","type":1,"min":"0","max":"100","step":"1"}37// Parameter: {"name":"pcen_loc_loc_f","value":"60","type":1,"min":"0","max":"100","step":"1"}38// Parameter: {"name":"pcen_loc_w","value":"100","type":1,"min":"0","max":"100","step":"1"}39// Parameter: {"name":"pcen_loc_d","value":"50","type":1,"min":"0","max":"100","step":"1"}40// Parameter: {"name":"pcen_loc_f","value":"60","type":1,"min":"0","max":"100","step":"1"}41// Parameter: {"name":"pcen_og_w","value":"50","type":1,"min":"0","max":"100","step":"1"}42// Parameter: {"name":"pcen_og_d","value":"50","type":1,"min":"0","max":"100","step":"1"}43// Parameter: {"name":"pcen_og_f","value":"50","type":1,"min":"0","max":"100","step":"1"}44// Parameter: {"name":"pcen_og2_w","value":100,"type":1,"min":"0","max":"100","step":"1"}45// Parameter: {"name":"pcen_og2_d","value":"30","type":1,"min":"0","max":"100","step":"1"}46// Parameter: {"name":"pcen_og2_f","value":"50","type":1,"min":"0","max":"100","step":"1"}47async function Building_max(__modules__, in_model, pcen_art_art_w, pcen_art_art_d, pcen_art_art_f, pcen_art_sec_w, pcen_art_sec_d, pcen_art_sec_f, pcen_art_loc_w, pcen_art_loc_d, pcen_art_loc_f, pcen_art_w, pcen_art_d, pcen_art_f, pcen_sec_sec_w, pcen_sec_sec_d, pcen_sec_sec_f, pcen_sec_loc_w, pcen_sec_loc_d, pcen_sec_loc_f, pcen_sec_w, pcen_sec_d, pcen_sec_f, pcen_loc_loc_w, pcen_loc_loc_d, pcen_loc_loc_f, pcen_loc_w, pcen_loc_d, pcen_loc_f, pcen_og_w, pcen_og_d, pcen_og_f, pcen_og2_w, pcen_og2_d, pcen_og2_f) {48const __debug__ = true;49const __model__ = null;50/** * **/51const PI = Math.PI;52const XY = __modules__._constants.XY;53const YZ = __modules__._constants.YZ;54const ZX = __modules__._constants.ZX;55const YX = __modules__._constants.YX;56const ZY = __modules__._constants.ZY;57const XZ = __modules__._constants.XZ;58const isNum = __modules__._types.isNum;59const isInt = __modules__._types.isInt;60const isFlt = __modules__._types.isFlt;61const isBool = __modules__._types.isBool;62const isStr = __modules__._types.isStr;63const isList = __modules__._types.isList;64const isDict = __modules__._types.isDict;65const isVec2 = __modules__._types.isVec2;66const isVec3 = __modules__._types.isVec3;67const isCol = __modules__._types.isCol;68const isRay = __modules__._types.isRay;69const isPln = __modules__._types.isPln;70const isNaN = __modules__._types.isNaN;71const isNull = __modules__._types.isNull;72const isUndef = __modules__._types.isUndef;73const strRepl = __modules__._strs.strRepl;74const strUpp = __modules__._strs.strUpp;75const strLow = __modules__._strs.strLow;76const strTrim = __modules__._strs.strTrim;77const strTrimR = __modules__._strs.strTrimR;78const strTrimL = __modules__._strs.strTrimL;79const strSub = __modules__._strs.strSub;80const strStarts = __modules__._strs.strStarts;81const strEnds = __modules__._strs.strEnds;82const strPadL = __modules__._strs.strPadL;83const strPadR = __modules__._strs.strPadR;84const isApprox = __modules__._util.isApprox;85const isIn = __modules__._util.isIn;86const isWithin = __modules__._util.isWithin;87const min = __modules__._math.min;88const max = __modules__._math.max;89const pow = Math.pow;90const sqrt = Math.sqrt;91const exp = Math.exp;92const log = Math.log;93const round = __modules__._math.round;94const sigFig = __modules__._math.sigFig;95const ceil = Math.ceil;96const floor = Math.floor;97const abs = Math.abs;98const sin = Math.sin;99const asin = Math.asin;100const sinh = Math.sinh;101const asinh = Math.asinh;102const cos = Math.cos;103const acos = Math.acos;104const cosh = Math.cosh;105const acosh = Math.acosh;106const tan = Math.tan;107const atan = Math.atan;108const tanh = Math.tanh;109const atanh = Math.atanh;110const atan2 = Math.atan2;111const boolean = __modules__._mathjs.boolean;112const number = __modules__._mathjs.number;113const string = __modules__._mathjs.string;114const mad = __modules__._mathjs.mad;115const mean = __modules__._mathjs.mean;116const median = __modules__._mathjs.median;117const mode = __modules__._mathjs.mode;118const prod = __modules__._mathjs.prod;119const std = __modules__._mathjs.std;120const vari = __modules__._mathjs.var;121const sum = __modules__._mathjs.sum;122const hypot = __modules__._mathjs.hypot;123const norm = __modules__._mathjs.norm;124const mod = __modules__._mathjs.mod;125const square = __modules__._mathjs.square;126const cube = __modules__._mathjs.cube;127const remap = __modules__._arithmetic.remap;128const distance = __modules__._geometry.distance;129const distanceM = __modules__._geometry.distanceM;130const distanceMS = __modules__._geometry.distanceMS;131const intersect = __modules__._geometry.intersect;132const project = __modules__._geometry.project;133const range = __modules__._list.range;134const len = __modules__._list.listLen;135const listLen = __modules__._list.listLen;136const listCount = __modules__._list.listCount;137const listCopy = __modules__._list.listCopy;138const listRep = __modules__._list.listRep;139const listLast = __modules__._list.listLast;140const listGet = __modules__._list.listGet;141const listFind = __modules__._list.listFind;142const listHas = __modules__._list.listHas;143const listJoin = __modules__._list.listJoin;144const listFlat = __modules__._list.listFlat;145const listSlice = __modules__._list.listSlice;146const listCull = __modules__._list.listCull;147const listZip = __modules__._list.listZip;148const listZip2 = __modules__._list.listZip2;149const listSort = __modules__._list.listSort;150const listRev = __modules__._list.listRev;151const setMake = __modules__._set.setMake;152const setUni = __modules__._set.setUni;153const setInt = __modules__._set.setInt;154const setDif = __modules__._set.setDif;155const length = __modules__._list.length;156const shuffle = __modules__._list.shuffle;157const concat = __modules__._list.concat;158const zip = __modules__._list.zip;159const zip2 = __modules__._list.zip2;160const vecAdd = __modules__._vec.vecAdd;161const vecSub = __modules__._vec.vecSub;162const vecDiv = __modules__._vec.vecDiv;163const vecMult = __modules__._vec.vecMult;164const vecSum = __modules__._vec.vecSum;165const vecLen = __modules__._vec.vecLen;166const vecSetLen = __modules__._vec.vecSetLen;167const vecNorm = __modules__._vec.vecNorm;168const vecRev = __modules__._vec.vecRev;169const vecFromTo = __modules__._vec.vecFromTo;170const vecAng = __modules__._vec.vecAng;171const vecAng2 = __modules__._vec.vecAng2;172const vecDot = __modules__._vec.vecDot;173const vecCross = __modules__._vec.vecCross;174const vecEqual = __modules__._vec.vecEqual;175const vecLtoG = __modules__._vec.vecLtoG;176const vecGtoL = __modules__._vec.vecGtoL;177const plnMake = __modules__._plane.plnMake;178const plnCopy = __modules__._plane.plnCopy;179const plnMove = __modules__._plane.plnMove;180const plnRot = __modules__._plane.plnRot;181const plnLMove = __modules__._plane.plnLMove;182const plnLRotX = __modules__._plane.plnLRotX;183const plnLRotY = __modules__._plane.plnLRotY;184const plnLRotZ = __modules__._plane.plnLRotZ;185const rayMake = __modules__._ray.rayMake;186const rayCopy = __modules__._ray.rayCopy;187const rayMove = __modules__._ray.rayMove;188const rayRot = __modules__._ray.rayRot;189const rayLMove = __modules__._ray.rayLMove;190const rayFromPln = __modules__._ray.rayFromPln;191const rayLtoG = __modules__._ray.rayLtoG;192const rayGtoL = __modules__._ray.rayGtoL;193const colFalse = __modules__._colors.colFalse;194const colScale = __modules__._colors.colScale;195const radToDeg = __modules__._conversion.radToDeg;196const degToRad = __modules__._conversion.degToRad;197const numToStr = __modules__._conversion.numToStr;198const rand = __modules__._rand.rand;199const randInt = __modules__._rand.randInt;200const randPick = __modules__._rand.randPick;201const setattr = __modules__._model.__setAttrib__;202const getattr = __modules__._model.__getAttrib__;203async function exec_Building_max(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){204async function exec_Building_max_node_45a8co2an3(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){205while (true) {206__modules__._model.__preprocess__( __params__.model);207let coll_tissue_ = await __modules__.io.Import( __params__.model, in_model_, 'gi' );208__modules__._model.__postprocess__( __params__.model);209break; }210return __params__.model;211}212async function exec_Building_max_node_nkkbwfhulom(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){213while (true) {214__modules__._model.__preprocess__( __params__.model);215let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "max_footprint");216for (let footprint_ of footprints_){217let num_floors_ = __modules__.attrib.Get(__params__.model, footprint_, 'max_floors');218if (num_floors_ > 0){219let bldg_ = __modules__.make.Extrude( __params__.model, footprint_, num_floors_ * 3, num_floors_, 'quads' );220__modules__.attrib.Set(__params__.model, bldg_, 'type', __modules__.attrib.Get(__params__.model, footprint_, 'type') );221__modules__.attrib.Set(__params__.model, bldg_.slice(0,-1), 'class', "bldg_facade" );222__modules__.attrib.Set(__params__.model, bldg_[pythonList(-1, bldg_.length)], 'class', "bldg_roof" );223}224}225__modules__._model.__postprocess__( __params__.model);226break; }227return __params__.model;228}229async function exec_Building_max_node_l2svedb9d2_applyColours_(__params__, colors_dict_, pgons_) {230let pgons_lists_ = {};231let cols_ = {};232let keys_ = [];233for (let pgon_ of pgons_){234let type_ = __modules__.attrib.Get(__params__.model, pgon_, 'type');235let col_ = colors_dict_[pythonList(type_, colors_dict_.length)];236if (col_ != undefined){237let key_ = string(col_);238let pgons_list_ = pgons_lists_[pythonList(key_, pgons_lists_.length)];239if (pgons_list_ == undefined){240pgons_list_ = [];241pgons_lists_[pythonList(key_, pgons_lists_.length)] = pgons_list_;242cols_[pythonList(key_, cols_.length)] = col_;243__modules__.list.Add( keys_, key_, 'to_end' );244}245__modules__.list.Add( pgons_list_, pgon_, 'to_end' );246}247}248for (let key_ of keys_){249pgons_ = pgons_lists_[pythonList(key_, pgons_lists_.length)];250let col_ = cols_[pythonList(key_, cols_.length)];251__modules__.visualize.Color( __params__.model, pgons_, col_ );252}253}254async function exec_Building_max_node_l2svedb9d2(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){255while (true) {256__modules__._model.__preprocess__( __params__.model);257let colors_dict_land_ = {};258colors_dict_land_["art_art"] = [0.8, 0.51, 0.48];259colors_dict_land_["art_sec"] = [0.85, 0.62, 0.6];260colors_dict_land_["art_loc"] = [0.9, 0.73, 0.72];261colors_dict_land_["art"] = [0.92, 0.79, 0.78];262colors_dict_land_["sec_sec"] = [0.98, 0.81, 0.69];263colors_dict_land_["sec_loc"] = [0.98, 0.86, 0.78];264colors_dict_land_["sec"] = [0.98, 0.91, 0.86];265colors_dict_land_["loc_loc"] = [0.98, 0.92, 0.73];266colors_dict_land_["loc"] = [0.98, 0.95, 0.83];267colors_dict_land_["entr0"] = [1, 0.98, 0.92];268colors_dict_land_["entr1"] = [1, 0.98, 0.92];269colors_dict_land_["off_grid"] = [0.81, 0.9, 0.95];270colors_dict_land_["off_grid0"] = [0.81, 0.9, 0.95];271colors_dict_land_["off_grid1"] = [0.68, 0.83, 0.9];272colors_dict_land_["off_grid2"] = [0.68, 0.83, 0.9];273colors_dict_land_["path0"] = [0.93, 1, 0.9];274colors_dict_land_["path1"] = [0.93, 1, 0.9];275colors_dict_land_["path2"] = [0.93, 1, 0.9];276colors_dict_land_["green0"] = [0.86, 0.95, 0.81];277colors_dict_land_["green1"] = [0.86, 0.95, 0.81];278colors_dict_land_["green2"] = [0.86, 0.95, 0.81];279colors_dict_land_["off_grid0_os"] = [0.75, 0.9, 0.67];280colors_dict_land_["off_grid1_os"] = [0.75, 0.9, 0.67];281colors_dict_land_["off_grid2_os"] = [0.75, 0.9, 0.67];282colors_dict_land_["loc_os"] = [0.75, 0.9, 0.67];283colors_dict_land_["loc_loc_os"] = [0.75, 0.9, 0.67];284colors_dict_land_["sec_os"] = [0.75, 0.9, 0.67];285colors_dict_land_["sec_loc_os"] = [0.75, 0.9, 0.67];286colors_dict_land_["sec_sec_os"] = [0.75, 0.9, 0.67];287colors_dict_land_["corner_park"] = [0.75, 0.9, 0.67];288colors_dict_land_["off_grid0_am"] = [0.85, 0.6, 0.66];289colors_dict_land_["off_grid1_am"] = [0.85, 0.6, 0.66];290colors_dict_land_["off_grid2_am"] = [0.85, 0.6, 0.66];291colors_dict_land_["loc_am"] = [0.85, 0.6, 0.66];292colors_dict_land_["loc_loc_am"] = [0.85, 0.6, 0.66];293colors_dict_land_["sec_am"] = [0.85, 0.6, 0.66];294colors_dict_land_["sec_loc_am"] = [0.85, 0.6, 0.66];295colors_dict_land_["sec_sec_am"] = [0.85, 0.6, 0.66];296colors_dict_land_["off_grid_too_small"] = [1, 0.7, 1];297colors_dict_land_["too_deep"] = [1, 0.7, 1];298colors_dict_land_["concave_corner"] = [1, 0.7, 1];299colors_dict_land_["leftover"] = [1, 0.7, 1];300let colors_dict_bldg_ = {};301colors_dict_bldg_["art_art"] = [0.8, 0.18, 0.12];302colors_dict_bldg_["art_sec"] = [0.85, 0.3, 0.25];303colors_dict_bldg_["art_loc"] = [0.9, 0.48, 0.45];304colors_dict_bldg_["art"] = [0.93, 0.59, 0.56];305colors_dict_bldg_["sec_sec"] = [0.98, 0.55, 0.24];306colors_dict_bldg_["sec_loc"] = [0.98, 0.65, 0.44];307colors_dict_bldg_["sec"] = [0.98, 0.75, 0.59];308colors_dict_bldg_["loc_loc"] = [0.98, 0.83, 0.34];309colors_dict_bldg_["loc"] = [0.98, 0.89, 0.59];310colors_dict_bldg_["off_grid"] = [0.54, 0.78, 0.9];311colors_dict_bldg_["off_grid0"] = [0.54, 0.78, 0.9];312colors_dict_bldg_["off_grid1"] = [0.54, 0.78, 0.9];313colors_dict_bldg_["off_grid2"] = [0.36, 0.66, 0.8];314colors_dict_bldg_["off_grid0_am"] = [0.75, 0.38, 0.47];315colors_dict_bldg_["off_grid1_am"] = [0.75, 0.38, 0.47];316colors_dict_bldg_["off_grid2_am"] = [0.75, 0.38, 0.47];317colors_dict_bldg_["loc_am"] = [0.75, 0.38, 0.47];318colors_dict_bldg_["loc_loc_am"] = [0.75, 0.38, 0.47];319colors_dict_bldg_["sec_am"] = [0.75, 0.38, 0.47];320colors_dict_bldg_["sec_loc_am"] = [0.75, 0.38, 0.47];321colors_dict_bldg_["sec_sec_am"] = [0.75, 0.38, 0.47];322let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_footprint");323let facades_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_facade");324let roofs_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_roof");325await exec_Building_max_node_l2svedb9d2_applyColours_(__params__, colors_dict_bldg_, listFlat([footprints_, facades_, roofs_]));326if (__params__.terminated) { return __params__.model;}327__modules__._model.__postprocess__( __params__.model);328break; }329return __params__.model;330}331async function exec_Building_max_node_qrfyegrokq_tree4half_(__params__, height_) {332let height_step_ = height_ / 6;333let width_ = (height_ / 3);334let width_step_ = width_ / 6;335let xyz0_ = [0, 0, 0];336let xyz1_ = [0.25, 0, 0];337let xyz2_ = [0.15, 0, height_step_ * 2];338let xyz3_ = [width_step_ * 3, 0, height_step_ * 3];339let xyz4_ = [width_, 0, height_step_ * 4];340let xyz5_ = [width_step_ * 3, 0, height_step_ * 5];341let xyz6_ = [0, 0, height_];342let xyzs_ = [xyz0_, xyz1_, xyz2_, xyz3_, xyz4_, xyz5_, xyz6_];343let mirror_ = [];344for (let i_ of range(0, len(xyzs_))){345if (i_ > 0 && i_ < len(xyzs_) - 1){346let xyzs_mirror_ = [xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] * -1, 0, xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)]];347__modules__.list.Add( mirror_, xyzs_mirror_, 'to_start' );348}349}350xyzs_ = listJoin(xyzs_, mirror_);351for (let i_ of range(0, len(xyzs_))){352if (i_ > 2 && i_ < len(xyzs_) - 2 && i_ != 6){353xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)] = xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)] + rand(-height_step_, height_step_);354xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] = xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] + rand(-width_step_, width_step_);355}356}357return xyzs_;358}359async function exec_Building_max_node_qrfyegrokq_tree4_(__params__, posi_, height_) {360let all_xyzs_ = [];361let cen_ = __modules__.attrib.Get(__params__.model, posi_, 'xyz');362let pln_ = [cen_, [1, 0, 0], [0, 1, 0]];363pln_ = plnLRotZ(pln_, JSON.parse(JSON.stringify(PI)) * rand(0, 1));364let height_step_ = height_ / 6;365height_ = height_ + rand(-height_step_, height_step_);366for (let i_ of range(2)){367pln_ = plnLRotZ(pln_, (JSON.parse(JSON.stringify(PI)) / 2) * i_);368let xyzs_ = await exec_Building_max_node_qrfyegrokq_tree4half_(__params__, height_);369if (__params__.terminated) { return __params__.model;}370let xyzs2_ = vecGtoL(xyzs_, pln_);371__modules__.list.Add( all_xyzs_, xyzs2_, 'to_end' );372}373let posis_ = __modules__.make.Position( __params__.model, all_xyzs_ );374let canopy_ = __modules__.make.Polygon( __params__.model, posis_ );375return canopy_;376}377async function exec_Building_max_node_qrfyegrokq(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){378while (true) {379__modules__._model.__preprocess__( __params__.model);380let trees_ = [];381if (__modules__.attrib.Get(__params__.model, null, 'add_trees')){382let tree_pts_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pt', null), ['type', null], '==', "tree");383for (let tree_pt_ of tree_pts_){384let tree_ = await exec_Building_max_node_qrfyegrokq_tree4_(__params__, __modules__.query.Get(__params__.model, 'ps', tree_pt_)[pythonList(0, __modules__.query.Get(__params__.model, 'ps', tree_pt_).length)], __modules__.attrib.Get(__params__.model, null, 'tree_height_max'));385if (__params__.terminated) { return __params__.model;}386__modules__.list.Add( trees_, tree_, 'extend_end' );387}388}389__modules__.visualize.Color( __params__.model, trees_, [0.5, 1, 0.5] );390__modules__._model.__postprocess__( __params__.model);391break; }392return __params__.model;393}394async function exec_Building_max_node_9f040gjcy4(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){395while (true) {396__modules__._model.__preprocess__( __params__.model);397return null;398break; }399}400var merged;401console.log("Executing Node: Start");402let result_exec_Building_max_node_4dg3sbnb261 = __params__.model;403console.log("Executing Node: import");404__params__.model = result_exec_Building_max_node_4dg3sbnb261;405let result_exec_Building_max_node_45a8co2an3 = await exec_Building_max_node_45a8co2an3(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);406console.log("Executing Node: extrude tissue");407__params__.model = result_exec_Building_max_node_45a8co2an3;408let result_exec_Building_max_node_nkkbwfhulom = await exec_Building_max_node_nkkbwfhulom(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);409console.log("Executing Node: colors");410__params__.model = result_exec_Building_max_node_nkkbwfhulom;411let result_exec_Building_max_node_l2svedb9d2 = await exec_Building_max_node_l2svedb9d2(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);412console.log("Executing Node: trees");413__params__.model = result_exec_Building_max_node_l2svedb9d2;414let result_exec_Building_max_node_qrfyegrokq = await exec_Building_max_node_qrfyegrokq(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);415console.log("Executing Node: End");416__params__.model = result_exec_Building_max_node_qrfyegrokq;417let result_exec_Building_max_node_9f040gjcy4 = await exec_Building_max_node_9f040gjcy4(__params__, in_model_, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);418return result_exec_Building_max_node_9f040gjcy4;419}420function pythonList(x, l){421 if (x < 0) {422 return x + l;423 }424 return x;425}426function mergeInputs(models){427 let result = null;428 if (models.length === 0) {429 result = __modules__._model.__new__();430 } else if (models.length === 1) {431 result = models[0].clone();432 } else {433 result = models[0].clone();434 for (let i = 1; i < models.length; i++) {435 __modules__._model.__merge__(result, models[i]);436 }437 }438 try {439 result.debug = __debug__;440 } catch (ex) {}441 return result;442}443function duplicateModel(model){444 const result = model.clone();445 try {446 result.debug = __debug__;447 } catch (ex) {}448 return result;449}450function printFunc(_console, name, value){451 let val;452 if (!value) {453 val = value;454 } else if (value === '__null__') {455 console.log('_ ' + name);456 return value;457 } else if (typeof value === 'number' || value === undefined) {458 val = value;459 } else if (typeof value === 'string') {460 val = value;461 } else if (value.constructor === [].constructor) {462 let __list_check__ = false;463 let __value_strings__ = [];464 for (const __item__ of value) {465 if (!__item__) {466 __value_strings__.push('' + __item__);467 continue;468 }469 if (__item__.constructor === [].constructor || __item__.constructor === {}.constructor) {470 __list_check__ = true;471 }472 __value_strings__.push(JSON.stringify(__item__).replace(/,/g, ', '));473 }474 if (__list_check__) {475 val = '[\n' + __value_strings__.join(',\n') + '\n]';476 } else {477 val = '[' + __value_strings__.join(', ') + ']';478 }479 } else if (value.constructor === {}.constructor) {480 let __list_check__ = false;481 let __value_strings__ = [];482 for (const __item__ in value) {483 const __value__ = value[__item__];484 if (!__value__) {485 __value_strings__.push( __item__ + ': ' + __value__);486 continue;487 }488 if (__value__.constructor === [].constructor || __value__.constructor === {}.constructor) {489 __list_check__ = true;490 }491 __value_strings__.push(__item__ + ': ' + JSON.stringify(__value__).replace(/,/g, ', '));492 }493 if (__list_check__) {494 val = '{\n' + __value_strings__.join(',\n') + '\n}';495 } else {496 val = '{' + __value_strings__.join(', ') + '}';497 }498 } else {499 val = value;500 }501 console.log(name + ' = ' + val);502 return val;503}504function printInp(in_model,pcen_art_art_w,pcen_art_art_d,pcen_art_art_f,pcen_art_sec_w,pcen_art_sec_d,pcen_art_sec_f,pcen_art_loc_w,pcen_art_loc_d,pcen_art_loc_f,pcen_art_w,pcen_art_d,pcen_art_f,pcen_sec_sec_w,pcen_sec_sec_d,pcen_sec_sec_f,pcen_sec_loc_w,pcen_sec_loc_d,pcen_sec_loc_f,pcen_sec_w,pcen_sec_d,pcen_sec_f,pcen_loc_loc_w,pcen_loc_loc_d,pcen_loc_loc_f,pcen_loc_w,pcen_loc_d,pcen_loc_f,pcen_og_w,pcen_og_d,pcen_og_f,pcen_og2_w,pcen_og2_d,pcen_og2_f){505console.log("Calling function Building_max() with the following arguments:\n" +506" in_model = " + in_model + "\n" +507" pcen_art_art_w = " + pcen_art_art_w + "\n" +508" pcen_art_art_d = " + pcen_art_art_d + "\n" +509" pcen_art_art_f = " + pcen_art_art_f + "\n" +510" pcen_art_sec_w = " + pcen_art_sec_w + "\n" +511" pcen_art_sec_d = " + pcen_art_sec_d + "\n" +512" pcen_art_sec_f = " + pcen_art_sec_f + "\n" +513" pcen_art_loc_w = " + pcen_art_loc_w + "\n" +514" pcen_art_loc_d = " + pcen_art_loc_d + "\n" +515" pcen_art_loc_f = " + pcen_art_loc_f + "\n" +516" pcen_art_w = " + pcen_art_w + "\n" +517" pcen_art_d = " + pcen_art_d + "\n" +518" pcen_art_f = " + pcen_art_f + "\n" +519" pcen_sec_sec_w = " + pcen_sec_sec_w + "\n" +520" pcen_sec_sec_d = " + pcen_sec_sec_d + "\n" +521" pcen_sec_sec_f = " + pcen_sec_sec_f + "\n" +522" pcen_sec_loc_w = " + pcen_sec_loc_w + "\n" +523" pcen_sec_loc_d = " + pcen_sec_loc_d + "\n" +524" pcen_sec_loc_f = " + pcen_sec_loc_f + "\n" +525" pcen_sec_w = " + pcen_sec_w + "\n" +526" pcen_sec_d = " + pcen_sec_d + "\n" +527" pcen_sec_f = " + pcen_sec_f + "\n" +528" pcen_loc_loc_w = " + pcen_loc_loc_w + "\n" +529" pcen_loc_loc_d = " + pcen_loc_loc_d + "\n" +530" pcen_loc_loc_f = " + pcen_loc_loc_f + "\n" +531" pcen_loc_w = " + pcen_loc_w + "\n" +532" pcen_loc_d = " + pcen_loc_d + "\n" +533" pcen_loc_f = " + pcen_loc_f + "\n" +534" pcen_og_w = " + pcen_og_w + "\n" +535" pcen_og_d = " + pcen_og_d + "\n" +536" pcen_og_f = " + pcen_og_f + "\n" +537" pcen_og2_w = " + pcen_og2_w + "\n" +538" pcen_og2_d = " + pcen_og2_d + "\n" +539" pcen_og2_f = " + pcen_og2_f + "\n" +540'')};541// printInp(in_model,pcen_art_art_w,pcen_art_art_d,pcen_art_art_f,pcen_art_sec_w,pcen_art_sec_d,pcen_art_sec_f,pcen_art_loc_w,pcen_art_loc_d,pcen_art_loc_f,pcen_art_w,pcen_art_d,pcen_art_f,pcen_sec_sec_w,pcen_sec_sec_d,pcen_sec_sec_f,pcen_sec_loc_w,pcen_sec_loc_d,pcen_sec_loc_f,pcen_sec_w,pcen_sec_d,pcen_sec_f,pcen_loc_loc_w,pcen_loc_loc_d,pcen_loc_loc_f,pcen_loc_w,pcen_loc_d,pcen_loc_f,pcen_og_w,pcen_og_d,pcen_og_f,pcen_og2_w,pcen_og2_d,pcen_og2_f);542const __params__ = {};543__params__["model"] = __modules__._model.__new__();544if (__model__) {545__modules__.io._importGI(__params__["model"], __model__);546}547__params__["model"].debug = __debug__;548__params__["console"] = [];549__params__["modules"] = __modules__;550const result = await exec_Building_max(__params__, in_model, pcen_art_art_w, pcen_art_art_d, pcen_art_art_f, pcen_art_sec_w, pcen_art_sec_d, pcen_art_sec_f, pcen_art_loc_w, pcen_art_loc_d, pcen_art_loc_f, pcen_art_w, pcen_art_d, pcen_art_f, pcen_sec_sec_w, pcen_sec_sec_d, pcen_sec_sec_f, pcen_sec_loc_w, pcen_sec_loc_d, pcen_sec_loc_f, pcen_sec_w, pcen_sec_d, pcen_sec_f, pcen_loc_loc_w, pcen_loc_loc_d, pcen_loc_loc_f, pcen_loc_w, pcen_loc_d, pcen_loc_f, pcen_og_w, pcen_og_d, pcen_og_f, pcen_og2_w, pcen_og2_d, pcen_og2_f);551if (result === __params__.model) { return { "model": __params__.model, "result": null };}552return {"model": __params__.model, "result": result};553/** * **/554}...
max_building20.js
Source:max_building20.js
1/**2 * to use this code: import Building_max from this js file as well as the GI module3 * run Building_max with the GI module as input along with other start node input4 * e.g.:5 * const Building_max = require('./Building_max.js').Building_max6 * const module = require('gi-module')7 * const result = await Building_max(module, start_input_1, start_input_2, ...);8 *9 * returns: a json object:10 * _ result.model -> gi model of the flowchart11 * _ result.result -> returned output of the flowchart, if the flowchart does not return any value, result.result is the model of the flowchart12 */13// Parameter: {"name":"pcen_art_art_w","value":"0","type":1,"min":"0","max":"100","step":"1"}14// Parameter: {"name":"pcen_art_art_d","value":"0","type":1,"min":"0","max":"100","step":"1"}15// Parameter: {"name":"pcen_art_art_f","value":"0","type":1,"min":"0","max":"100","step":"1"}16// Parameter: {"name":"pcen_art_sec_w","value":"0","type":1,"min":"0","max":"100","step":"1"}17// Parameter: {"name":"pcen_art_sec_d","value":"0","type":1,"min":"0","max":"100","step":"1"}18// Parameter: {"name":"pcen_art_sec_f","value":"0","type":1,"min":"0","max":"100","step":"1"}19// Parameter: {"name":"pcen_art_loc_w","value":0,"type":1,"min":"0","max":"100","step":"1"}20// Parameter: {"name":"pcen_art_loc_d","value":0,"type":1,"min":"0","max":"100","step":"1"}21// Parameter: {"name":"pcen_art_loc_f","value":0,"type":1,"min":"0","max":"100","step":"1"}22// Parameter: {"name":"pcen_art_w","value":"100","type":1,"min":"0","max":"100","step":"1"}23// Parameter: {"name":"pcen_art_d","value":"60","type":1,"min":"0","max":"100","step":"1"}24// Parameter: {"name":"pcen_art_f","value":"80","type":1,"min":"0","max":"100","step":"1"}25// Parameter: {"name":"pcen_sec_sec_w","value":"0","type":1,"min":"0","max":"100","step":"1"}26// Parameter: {"name":"pcen_sec_sec_d","value":"0","type":1,"min":"0","max":"100","step":"1"}27// Parameter: {"name":"pcen_sec_sec_f","value":"0","type":1,"min":"0","max":"100","step":"1"}28// Parameter: {"name":"pcen_sec_loc_w","value":"0","type":1,"min":"0","max":"100","step":"1"}29// Parameter: {"name":"pcen_sec_loc_d","value":"0","type":1,"min":"0","max":"100","step":"1"}30// Parameter: {"name":"pcen_sec_loc_f","value":"0","type":1,"min":"0","max":"100","step":"1"}31// Parameter: {"name":"pcen_sec_w","value":"100","type":1,"min":"0","max":"100","step":"1"}32// Parameter: {"name":"pcen_sec_d","value":"70","type":1,"min":"0","max":"100","step":"1"}33// Parameter: {"name":"pcen_sec_f","value":"80","type":1,"min":"0","max":"100","step":"1"}34// Parameter: {"name":"pcen_loc_loc_w","value":"100","type":1,"min":"0","max":"100","step":"1"}35// Parameter: {"name":"pcen_loc_loc_d","value":"100","type":1,"min":"0","max":"100","step":"1"}36// Parameter: {"name":"pcen_loc_loc_f","value":"60","type":1,"min":"0","max":"100","step":"1"}37// Parameter: {"name":"pcen_loc_w","value":"100","type":1,"min":"0","max":"100","step":"1"}38// Parameter: {"name":"pcen_loc_d","value":"50","type":1,"min":"0","max":"100","step":"1"}39// Parameter: {"name":"pcen_loc_f","value":"60","type":1,"min":"0","max":"100","step":"1"}40// Parameter: {"name":"pcen_og_w","value":"50","type":1,"min":"0","max":"100","step":"1"}41// Parameter: {"name":"pcen_og_d","value":"50","type":1,"min":"0","max":"100","step":"1"}42// Parameter: {"name":"pcen_og_f","value":"50","type":1,"min":"0","max":"100","step":"1"}43// Parameter: {"name":"pcen_og2_w","value":100,"type":1,"min":"0","max":"100","step":"1"}44// Parameter: {"name":"pcen_og2_d","value":"30","type":1,"min":"0","max":"100","step":"1"}45// Parameter: {"name":"pcen_og2_f","value":"50","type":1,"min":"0","max":"100","step":"1"}46async function max_building(__modules__, pcen_art_art_w, pcen_art_art_d, pcen_art_art_f, pcen_art_sec_w, pcen_art_sec_d, pcen_art_sec_f, pcen_art_loc_w, pcen_art_loc_d, pcen_art_loc_f, pcen_art_w, pcen_art_d, pcen_art_f, pcen_sec_sec_w, pcen_sec_sec_d, pcen_sec_sec_f, pcen_sec_loc_w, pcen_sec_loc_d, pcen_sec_loc_f, pcen_sec_w, pcen_sec_d, pcen_sec_f, pcen_loc_loc_w, pcen_loc_loc_d, pcen_loc_loc_f, pcen_loc_w, pcen_loc_d, pcen_loc_f, pcen_og_w, pcen_og_d, pcen_og_f, pcen_og2_w, pcen_og2_d, pcen_og2_f) {47const __debug__ = true;48const __model__ = null;49/** * **/50const PI = Math.PI;51const XY = __modules__._constants.XY;52const YZ = __modules__._constants.YZ;53const ZX = __modules__._constants.ZX;54const YX = __modules__._constants.YX;55const ZY = __modules__._constants.ZY;56const XZ = __modules__._constants.XZ;57const isNum = __modules__._types.isNum;58const isInt = __modules__._types.isInt;59const isFlt = __modules__._types.isFlt;60const isBool = __modules__._types.isBool;61const isStr = __modules__._types.isStr;62const isList = __modules__._types.isList;63const isDict = __modules__._types.isDict;64const isVec2 = __modules__._types.isVec2;65const isVec3 = __modules__._types.isVec3;66const isCol = __modules__._types.isCol;67const isRay = __modules__._types.isRay;68const isPln = __modules__._types.isPln;69const isNaN = __modules__._types.isNaN;70const isNull = __modules__._types.isNull;71const isUndef = __modules__._types.isUndef;72const strRepl = __modules__._strs.strRepl;73const strUpp = __modules__._strs.strUpp;74const strLow = __modules__._strs.strLow;75const strTrim = __modules__._strs.strTrim;76const strTrimR = __modules__._strs.strTrimR;77const strTrimL = __modules__._strs.strTrimL;78const strSub = __modules__._strs.strSub;79const strStarts = __modules__._strs.strStarts;80const strEnds = __modules__._strs.strEnds;81const strPadL = __modules__._strs.strPadL;82const strPadR = __modules__._strs.strPadR;83const isApprox = __modules__._util.isApprox;84const isIn = __modules__._util.isIn;85const isWithin = __modules__._util.isWithin;86const min = __modules__._math.min;87const max = __modules__._math.max;88const pow = Math.pow;89const sqrt = Math.sqrt;90const exp = Math.exp;91const log = Math.log;92const round = __modules__._math.round;93const sigFig = __modules__._math.sigFig;94const ceil = Math.ceil;95const floor = Math.floor;96const abs = Math.abs;97const sin = Math.sin;98const asin = Math.asin;99const sinh = Math.sinh;100const asinh = Math.asinh;101const cos = Math.cos;102const acos = Math.acos;103const cosh = Math.cosh;104const acosh = Math.acosh;105const tan = Math.tan;106const atan = Math.atan;107const tanh = Math.tanh;108const atanh = Math.atanh;109const atan2 = Math.atan2;110const boolean = __modules__._mathjs.boolean;111const number = __modules__._mathjs.number;112const string = __modules__._mathjs.string;113const mad = __modules__._mathjs.mad;114const mean = __modules__._mathjs.mean;115const median = __modules__._mathjs.median;116const mode = __modules__._mathjs.mode;117const prod = __modules__._mathjs.prod;118const std = __modules__._mathjs.std;119const vari = __modules__._mathjs.var;120const sum = __modules__._mathjs.sum;121const hypot = __modules__._mathjs.hypot;122const norm = __modules__._mathjs.norm;123const mod = __modules__._mathjs.mod;124const square = __modules__._mathjs.square;125const cube = __modules__._mathjs.cube;126const remap = __modules__._arithmetic.remap;127const distance = __modules__._geometry.distance;128const distanceM = __modules__._geometry.distanceM;129const distanceMS = __modules__._geometry.distanceMS;130const intersect = __modules__._geometry.intersect;131const project = __modules__._geometry.project;132const range = __modules__._list.range;133const len = __modules__._list.listLen;134const listLen = __modules__._list.listLen;135const listCount = __modules__._list.listCount;136const listCopy = __modules__._list.listCopy;137const listRep = __modules__._list.listRep;138const listLast = __modules__._list.listLast;139const listGet = __modules__._list.listGet;140const listFind = __modules__._list.listFind;141const listHas = __modules__._list.listHas;142const listJoin = __modules__._list.listJoin;143const listFlat = __modules__._list.listFlat;144const listSlice = __modules__._list.listSlice;145const listCull = __modules__._list.listCull;146const listZip = __modules__._list.listZip;147const listZip2 = __modules__._list.listZip2;148const listSort = __modules__._list.listSort;149const listRev = __modules__._list.listRev;150const setMake = __modules__._set.setMake;151const setUni = __modules__._set.setUni;152const setInt = __modules__._set.setInt;153const setDif = __modules__._set.setDif;154const length = __modules__._list.length;155const shuffle = __modules__._list.shuffle;156const concat = __modules__._list.concat;157const zip = __modules__._list.zip;158const zip2 = __modules__._list.zip2;159const vecAdd = __modules__._vec.vecAdd;160const vecSub = __modules__._vec.vecSub;161const vecDiv = __modules__._vec.vecDiv;162const vecMult = __modules__._vec.vecMult;163const vecSum = __modules__._vec.vecSum;164const vecLen = __modules__._vec.vecLen;165const vecSetLen = __modules__._vec.vecSetLen;166const vecNorm = __modules__._vec.vecNorm;167const vecRev = __modules__._vec.vecRev;168const vecFromTo = __modules__._vec.vecFromTo;169const vecAng = __modules__._vec.vecAng;170const vecAng2 = __modules__._vec.vecAng2;171const vecDot = __modules__._vec.vecDot;172const vecCross = __modules__._vec.vecCross;173const vecEqual = __modules__._vec.vecEqual;174const vecLtoG = __modules__._vec.vecLtoG;175const vecGtoL = __modules__._vec.vecGtoL;176const plnMake = __modules__._plane.plnMake;177const plnCopy = __modules__._plane.plnCopy;178const plnMove = __modules__._plane.plnMove;179const plnRot = __modules__._plane.plnRot;180const plnLMove = __modules__._plane.plnLMove;181const plnLRotX = __modules__._plane.plnLRotX;182const plnLRotY = __modules__._plane.plnLRotY;183const plnLRotZ = __modules__._plane.plnLRotZ;184const rayMake = __modules__._ray.rayMake;185const rayCopy = __modules__._ray.rayCopy;186const rayMove = __modules__._ray.rayMove;187const rayRot = __modules__._ray.rayRot;188const rayLMove = __modules__._ray.rayLMove;189const rayFromPln = __modules__._ray.rayFromPln;190const rayLtoG = __modules__._ray.rayLtoG;191const rayGtoL = __modules__._ray.rayGtoL;192const colFalse = __modules__._colors.colFalse;193const colScale = __modules__._colors.colScale;194const radToDeg = __modules__._conversion.radToDeg;195const degToRad = __modules__._conversion.degToRad;196const numToStr = __modules__._conversion.numToStr;197const rand = __modules__._rand.rand;198const randInt = __modules__._rand.randInt;199const randPick = __modules__._rand.randPick;200const setattr = __modules__._model.__setAttrib__;201const getattr = __modules__._model.__getAttrib__;202async function exec_Building_max(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){203async function exec_Building_max_node_45a8co2an3(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){204while (true) {205__modules__._model.__preprocess__( __params__.model);206let coll_tissue_ = await __modules__.io.Import( __params__.model, "tissue.gi", 'gi' );207__modules__._model.__postprocess__( __params__.model);208break; }209return __params__.model;210}211async function exec_Building_max_node_nkkbwfhulom(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){212while (true) {213__modules__._model.__preprocess__( __params__.model);214let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "max_footprint");215for (let footprint_ of footprints_){216let num_floors_ = __modules__.attrib.Get(__params__.model, footprint_, 'max_floors');217if (num_floors_ > 0){218let bldg_ = __modules__.make.Extrude( __params__.model, footprint_, num_floors_ * 3, num_floors_, 'quads' );219__modules__.attrib.Set(__params__.model, bldg_, 'type', __modules__.attrib.Get(__params__.model, footprint_, 'type') );220__modules__.attrib.Set(__params__.model, bldg_.slice(0,-1), 'class', "bldg_facade" );221__modules__.attrib.Set(__params__.model, bldg_[pythonList(-1, bldg_.length)], 'class', "bldg_roof" );222}223}224__modules__._model.__postprocess__( __params__.model);225break; }226return __params__.model;227}228async function exec_Building_max_node_l2svedb9d2_applyColours_(__params__, colors_dict_, pgons_) {229let pgons_lists_ = {};230let cols_ = {};231let keys_ = [];232for (let pgon_ of pgons_){233let type_ = __modules__.attrib.Get(__params__.model, pgon_, 'type');234let col_ = colors_dict_[pythonList(type_, colors_dict_.length)];235if (col_ != undefined){236let key_ = string(col_);237let pgons_list_ = pgons_lists_[pythonList(key_, pgons_lists_.length)];238if (pgons_list_ == undefined){239pgons_list_ = [];240pgons_lists_[pythonList(key_, pgons_lists_.length)] = pgons_list_;241cols_[pythonList(key_, cols_.length)] = col_;242__modules__.list.Add( keys_, key_, 'to_end' );243}244__modules__.list.Add( pgons_list_, pgon_, 'to_end' );245}246}247for (let key_ of keys_){248pgons_ = pgons_lists_[pythonList(key_, pgons_lists_.length)];249let col_ = cols_[pythonList(key_, cols_.length)];250__modules__.visualize.Color( __params__.model, pgons_, col_ );251}252}253async function exec_Building_max_node_l2svedb9d2(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){254while (true) {255__modules__._model.__preprocess__( __params__.model);256let colors_dict_land_ = {};257colors_dict_land_["art_art"] = [0.8, 0.51, 0.48];258colors_dict_land_["art_sec"] = [0.85, 0.62, 0.6];259colors_dict_land_["art_loc"] = [0.9, 0.73, 0.72];260colors_dict_land_["art"] = [0.92, 0.79, 0.78];261colors_dict_land_["sec_sec"] = [0.98, 0.81, 0.69];262colors_dict_land_["sec_loc"] = [0.98, 0.86, 0.78];263colors_dict_land_["sec"] = [0.98, 0.91, 0.86];264colors_dict_land_["loc_loc"] = [0.98, 0.92, 0.73];265colors_dict_land_["loc"] = [0.98, 0.95, 0.83];266colors_dict_land_["entr0"] = [1, 0.98, 0.92];267colors_dict_land_["entr1"] = [1, 0.98, 0.92];268colors_dict_land_["off_grid"] = [0.81, 0.9, 0.95];269colors_dict_land_["off_grid0"] = [0.81, 0.9, 0.95];270colors_dict_land_["off_grid1"] = [0.68, 0.83, 0.9];271colors_dict_land_["off_grid2"] = [0.68, 0.83, 0.9];272colors_dict_land_["path0"] = [0.93, 1, 0.9];273colors_dict_land_["path1"] = [0.93, 1, 0.9];274colors_dict_land_["path2"] = [0.93, 1, 0.9];275colors_dict_land_["green0"] = [0.86, 0.95, 0.81];276colors_dict_land_["green1"] = [0.86, 0.95, 0.81];277colors_dict_land_["green2"] = [0.86, 0.95, 0.81];278colors_dict_land_["off_grid0_os"] = [0.75, 0.9, 0.67];279colors_dict_land_["off_grid1_os"] = [0.75, 0.9, 0.67];280colors_dict_land_["off_grid2_os"] = [0.75, 0.9, 0.67];281colors_dict_land_["loc_os"] = [0.75, 0.9, 0.67];282colors_dict_land_["loc_loc_os"] = [0.75, 0.9, 0.67];283colors_dict_land_["sec_os"] = [0.75, 0.9, 0.67];284colors_dict_land_["sec_loc_os"] = [0.75, 0.9, 0.67];285colors_dict_land_["sec_sec_os"] = [0.75, 0.9, 0.67];286colors_dict_land_["corner_park"] = [0.75, 0.9, 0.67];287colors_dict_land_["off_grid0_am"] = [0.85, 0.6, 0.66];288colors_dict_land_["off_grid1_am"] = [0.85, 0.6, 0.66];289colors_dict_land_["off_grid2_am"] = [0.85, 0.6, 0.66];290colors_dict_land_["loc_am"] = [0.85, 0.6, 0.66];291colors_dict_land_["loc_loc_am"] = [0.85, 0.6, 0.66];292colors_dict_land_["sec_am"] = [0.85, 0.6, 0.66];293colors_dict_land_["sec_loc_am"] = [0.85, 0.6, 0.66];294colors_dict_land_["sec_sec_am"] = [0.85, 0.6, 0.66];295colors_dict_land_["off_grid_too_small"] = [1, 0.7, 1];296colors_dict_land_["too_deep"] = [1, 0.7, 1];297colors_dict_land_["concave_corner"] = [1, 0.7, 1];298colors_dict_land_["leftover"] = [1, 0.7, 1];299let colors_dict_bldg_ = {};300colors_dict_bldg_["art_art"] = [0.8, 0.18, 0.12];301colors_dict_bldg_["art_sec"] = [0.85, 0.3, 0.25];302colors_dict_bldg_["art_loc"] = [0.9, 0.48, 0.45];303colors_dict_bldg_["art"] = [0.93, 0.59, 0.56];304colors_dict_bldg_["sec_sec"] = [0.98, 0.55, 0.24];305colors_dict_bldg_["sec_loc"] = [0.98, 0.65, 0.44];306colors_dict_bldg_["sec"] = [0.98, 0.75, 0.59];307colors_dict_bldg_["loc_loc"] = [0.98, 0.83, 0.34];308colors_dict_bldg_["loc"] = [0.98, 0.89, 0.59];309colors_dict_bldg_["off_grid"] = [0.54, 0.78, 0.9];310colors_dict_bldg_["off_grid0"] = [0.54, 0.78, 0.9];311colors_dict_bldg_["off_grid1"] = [0.54, 0.78, 0.9];312colors_dict_bldg_["off_grid2"] = [0.36, 0.66, 0.8];313colors_dict_bldg_["off_grid0_am"] = [0.75, 0.38, 0.47];314colors_dict_bldg_["off_grid1_am"] = [0.75, 0.38, 0.47];315colors_dict_bldg_["off_grid2_am"] = [0.75, 0.38, 0.47];316colors_dict_bldg_["loc_am"] = [0.75, 0.38, 0.47];317colors_dict_bldg_["loc_loc_am"] = [0.75, 0.38, 0.47];318colors_dict_bldg_["sec_am"] = [0.75, 0.38, 0.47];319colors_dict_bldg_["sec_loc_am"] = [0.75, 0.38, 0.47];320colors_dict_bldg_["sec_sec_am"] = [0.75, 0.38, 0.47];321let footprints_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_footprint");322let facades_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_facade");323let roofs_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pg', null), ['class', null], '==', "bldg_roof");324await exec_Building_max_node_l2svedb9d2_applyColours_(__params__, colors_dict_bldg_, listFlat([footprints_, facades_, roofs_]));325if (__params__.terminated) { return __params__.model;}326__modules__._model.__postprocess__( __params__.model);327break; }328return __params__.model;329}330async function exec_Building_max_node_qrfyegrokq_tree4half_(__params__, height_) {331let height_step_ = height_ / 6;332let width_ = (height_ / 3);333let width_step_ = width_ / 6;334let xyz0_ = [0, 0, 0];335let xyz1_ = [0.25, 0, 0];336let xyz2_ = [0.15, 0, height_step_ * 2];337let xyz3_ = [width_step_ * 3, 0, height_step_ * 3];338let xyz4_ = [width_, 0, height_step_ * 4];339let xyz5_ = [width_step_ * 3, 0, height_step_ * 5];340let xyz6_ = [0, 0, height_];341let xyzs_ = [xyz0_, xyz1_, xyz2_, xyz3_, xyz4_, xyz5_, xyz6_];342let mirror_ = [];343for (let i_ of range(0, len(xyzs_))){344if (i_ > 0 && i_ < len(xyzs_) - 1){345let xyzs_mirror_ = [xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] * -1, 0, xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)]];346__modules__.list.Add( mirror_, xyzs_mirror_, 'to_start' );347}348}349xyzs_ = listJoin(xyzs_, mirror_);350for (let i_ of range(0, len(xyzs_))){351if (i_ > 2 && i_ < len(xyzs_) - 2 && i_ != 6){352xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)] = xyzs_[pythonList(i_, xyzs_.length)][pythonList(2, xyzs_[pythonList(i_, xyzs_.length)].length)] + rand(-height_step_, height_step_);353xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] = xyzs_[pythonList(i_, xyzs_.length)][pythonList(0, xyzs_[pythonList(i_, xyzs_.length)].length)] + rand(-width_step_, width_step_);354}355}356return xyzs_;357}358async function exec_Building_max_node_qrfyegrokq_tree4_(__params__, posi_, height_) {359let all_xyzs_ = [];360let cen_ = __modules__.attrib.Get(__params__.model, posi_, 'xyz');361let pln_ = [cen_, [1, 0, 0], [0, 1, 0]];362pln_ = plnLRotZ(pln_, JSON.parse(JSON.stringify(PI)) * rand(0, 1));363let height_step_ = height_ / 6;364height_ = height_ + rand(-height_step_, height_step_);365for (let i_ of range(2)){366pln_ = plnLRotZ(pln_, (JSON.parse(JSON.stringify(PI)) / 2) * i_);367let xyzs_ = await exec_Building_max_node_qrfyegrokq_tree4half_(__params__, height_);368if (__params__.terminated) { return __params__.model;}369let xyzs2_ = vecGtoL(xyzs_, pln_);370__modules__.list.Add( all_xyzs_, xyzs2_, 'to_end' );371}372let posis_ = __modules__.make.Position( __params__.model, all_xyzs_ );373let canopy_ = __modules__.make.Polygon( __params__.model, posis_ );374return canopy_;375}376async function exec_Building_max_node_qrfyegrokq(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){377while (true) {378__modules__._model.__preprocess__( __params__.model);379let trees_ = [];380if (__modules__.attrib.Get(__params__.model, null, 'add_trees')){381let tree_pts_ = __modules__.query.Filter(__params__.model, __modules__.query.Get(__params__.model, 'pt', null), ['type', null], '==', "tree");382for (let tree_pt_ of tree_pts_){383let tree_ = await exec_Building_max_node_qrfyegrokq_tree4_(__params__, __modules__.query.Get(__params__.model, 'ps', tree_pt_)[pythonList(0, __modules__.query.Get(__params__.model, 'ps', tree_pt_).length)], __modules__.attrib.Get(__params__.model, null, 'tree_height_max'));384if (__params__.terminated) { return __params__.model;}385__modules__.list.Add( trees_, tree_, 'extend_end' );386}387}388__modules__.visualize.Color( __params__.model, trees_, [0.5, 1, 0.5] );389__modules__._model.__postprocess__( __params__.model);390break; }391return __params__.model;392}393async function exec_Building_max_node_9f040gjcy4(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_){394while (true) {395__modules__._model.__preprocess__( __params__.model);396return null;397break; }398}399var merged;400console.log("Executing Node: Start");401let result_exec_Building_max_node_4dg3sbnb261 = __params__.model;402console.log("Executing Node: import");403__params__.model = result_exec_Building_max_node_4dg3sbnb261;404let result_exec_Building_max_node_45a8co2an3 = await exec_Building_max_node_45a8co2an3(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);405console.log("Executing Node: extrude tissue");406__params__.model = result_exec_Building_max_node_45a8co2an3;407let result_exec_Building_max_node_nkkbwfhulom = await exec_Building_max_node_nkkbwfhulom(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);408console.log("Executing Node: colors");409__params__.model = result_exec_Building_max_node_nkkbwfhulom;410let result_exec_Building_max_node_l2svedb9d2 = await exec_Building_max_node_l2svedb9d2(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);411console.log("Executing Node: trees");412__params__.model = result_exec_Building_max_node_l2svedb9d2;413let result_exec_Building_max_node_qrfyegrokq = await exec_Building_max_node_qrfyegrokq(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);414console.log("Executing Node: End");415__params__.model = result_exec_Building_max_node_qrfyegrokq;416let result_exec_Building_max_node_9f040gjcy4 = await exec_Building_max_node_9f040gjcy4(__params__, pcen_art_art_w_, pcen_art_art_d_, pcen_art_art_f_, pcen_art_sec_w_, pcen_art_sec_d_, pcen_art_sec_f_, pcen_art_loc_w_, pcen_art_loc_d_, pcen_art_loc_f_, pcen_art_w_, pcen_art_d_, pcen_art_f_, pcen_sec_sec_w_, pcen_sec_sec_d_, pcen_sec_sec_f_, pcen_sec_loc_w_, pcen_sec_loc_d_, pcen_sec_loc_f_, pcen_sec_w_, pcen_sec_d_, pcen_sec_f_, pcen_loc_loc_w_, pcen_loc_loc_d_, pcen_loc_loc_f_, pcen_loc_w_, pcen_loc_d_, pcen_loc_f_, pcen_og_w_, pcen_og_d_, pcen_og_f_, pcen_og2_w_, pcen_og2_d_, pcen_og2_f_);417return result_exec_Building_max_node_9f040gjcy4;418}419function pythonList(x, l){420 if (x < 0) {421 return x + l;422 }423 return x;424}425function mergeInputs(models){426 let result = null;427 if (models.length === 0) {428 result = __modules__._model.__new__();429 } else if (models.length === 1) {430 result = models[0].clone();431 } else {432 result = models[0].clone();433 for (let i = 1; i < models.length; i++) {434 __modules__._model.__merge__(result, models[i]);435 }436 }437 try {438 result.debug = __debug__;439 } catch (ex) {}440 return result;441}442function duplicateModel(model){443 const result = model.clone();444 try {445 result.debug = __debug__;446 } catch (ex) {}447 return result;448}449function printFunc(_console, name, value){450 let val;451 if (!value) {452 val = value;453 } else if (value === '__null__') {454 console.log('_ ' + name);455 return value;456 } else if (typeof value === 'number' || value === undefined) {457 val = value;458 } else if (typeof value === 'string') {459 val = value;460 } else if (value.constructor === [].constructor) {461 let __list_check__ = false;462 let __value_strings__ = [];463 for (const __item__ of value) {464 if (!__item__) {465 __value_strings__.push('' + __item__);466 continue;467 }468 if (__item__.constructor === [].constructor || __item__.constructor === {}.constructor) {469 __list_check__ = true;470 }471 __value_strings__.push(JSON.stringify(__item__).replace(/,/g, ', '));472 }473 if (__list_check__) {474 val = '[\n' + __value_strings__.join(',\n') + '\n]';475 } else {476 val = '[' + __value_strings__.join(', ') + ']';477 }478 } else if (value.constructor === {}.constructor) {479 let __list_check__ = false;480 let __value_strings__ = [];481 for (const __item__ in value) {482 const __value__ = value[__item__];483 if (!__value__) {484 __value_strings__.push( __item__ + ': ' + __value__);485 continue;486 }487 if (__value__.constructor === [].constructor || __value__.constructor === {}.constructor) {488 __list_check__ = true;489 }490 __value_strings__.push(__item__ + ': ' + JSON.stringify(__value__).replace(/,/g, ', '));491 }492 if (__list_check__) {493 val = '{\n' + __value_strings__.join(',\n') + '\n}';494 } else {495 val = '{' + __value_strings__.join(', ') + '}';496 }497 } else {498 val = value;499 }500 console.log(name + ' = ' + val);501 return val;502}503function printInp(pcen_art_art_w,pcen_art_art_d,pcen_art_art_f,pcen_art_sec_w,pcen_art_sec_d,pcen_art_sec_f,pcen_art_loc_w,pcen_art_loc_d,pcen_art_loc_f,pcen_art_w,pcen_art_d,pcen_art_f,pcen_sec_sec_w,pcen_sec_sec_d,pcen_sec_sec_f,pcen_sec_loc_w,pcen_sec_loc_d,pcen_sec_loc_f,pcen_sec_w,pcen_sec_d,pcen_sec_f,pcen_loc_loc_w,pcen_loc_loc_d,pcen_loc_loc_f,pcen_loc_w,pcen_loc_d,pcen_loc_f,pcen_og_w,pcen_og_d,pcen_og_f,pcen_og2_w,pcen_og2_d,pcen_og2_f){504console.log("Calling function Building_max() with the following arguments:\n" +505" pcen_art_art_w = " + pcen_art_art_w + "\n" +506" pcen_art_art_d = " + pcen_art_art_d + "\n" +507" pcen_art_art_f = " + pcen_art_art_f + "\n" +508" pcen_art_sec_w = " + pcen_art_sec_w + "\n" +509" pcen_art_sec_d = " + pcen_art_sec_d + "\n" +510" pcen_art_sec_f = " + pcen_art_sec_f + "\n" +511" pcen_art_loc_w = " + pcen_art_loc_w + "\n" +512" pcen_art_loc_d = " + pcen_art_loc_d + "\n" +513" pcen_art_loc_f = " + pcen_art_loc_f + "\n" +514" pcen_art_w = " + pcen_art_w + "\n" +515" pcen_art_d = " + pcen_art_d + "\n" +516" pcen_art_f = " + pcen_art_f + "\n" +517" pcen_sec_sec_w = " + pcen_sec_sec_w + "\n" +518" pcen_sec_sec_d = " + pcen_sec_sec_d + "\n" +519" pcen_sec_sec_f = " + pcen_sec_sec_f + "\n" +520" pcen_sec_loc_w = " + pcen_sec_loc_w + "\n" +521" pcen_sec_loc_d = " + pcen_sec_loc_d + "\n" +522" pcen_sec_loc_f = " + pcen_sec_loc_f + "\n" +523" pcen_sec_w = " + pcen_sec_w + "\n" +524" pcen_sec_d = " + pcen_sec_d + "\n" +525" pcen_sec_f = " + pcen_sec_f + "\n" +526" pcen_loc_loc_w = " + pcen_loc_loc_w + "\n" +527" pcen_loc_loc_d = " + pcen_loc_loc_d + "\n" +528" pcen_loc_loc_f = " + pcen_loc_loc_f + "\n" +529" pcen_loc_w = " + pcen_loc_w + "\n" +530" pcen_loc_d = " + pcen_loc_d + "\n" +531" pcen_loc_f = " + pcen_loc_f + "\n" +532" pcen_og_w = " + pcen_og_w + "\n" +533" pcen_og_d = " + pcen_og_d + "\n" +534" pcen_og_f = " + pcen_og_f + "\n" +535" pcen_og2_w = " + pcen_og2_w + "\n" +536" pcen_og2_d = " + pcen_og2_d + "\n" +537" pcen_og2_f = " + pcen_og2_f + "\n" +538'')};539// printInp(pcen_art_art_w,pcen_art_art_d,pcen_art_art_f,pcen_art_sec_w,pcen_art_sec_d,pcen_art_sec_f,pcen_art_loc_w,pcen_art_loc_d,pcen_art_loc_f,pcen_art_w,pcen_art_d,pcen_art_f,pcen_sec_sec_w,pcen_sec_sec_d,pcen_sec_sec_f,pcen_sec_loc_w,pcen_sec_loc_d,pcen_sec_loc_f,pcen_sec_w,pcen_sec_d,pcen_sec_f,pcen_loc_loc_w,pcen_loc_loc_d,pcen_loc_loc_f,pcen_loc_w,pcen_loc_d,pcen_loc_f,pcen_og_w,pcen_og_d,pcen_og_f,pcen_og2_w,pcen_og2_d,pcen_og2_f);540const __params__ = {};541__params__["model"] = __modules__._model.__new__();542if (__model__) {543__modules__.io._importGI(__params__["model"], __model__);544}545__params__["model"].debug = __debug__;546__params__["console"] = [];547__params__["modules"] = __modules__;548const result = await exec_Building_max(__params__, pcen_art_art_w, pcen_art_art_d, pcen_art_art_f, pcen_art_sec_w, pcen_art_sec_d, pcen_art_sec_f, pcen_art_loc_w, pcen_art_loc_d, pcen_art_loc_f, pcen_art_w, pcen_art_d, pcen_art_f, pcen_sec_sec_w, pcen_sec_sec_d, pcen_sec_sec_f, pcen_sec_loc_w, pcen_sec_loc_d, pcen_sec_loc_f, pcen_sec_w, pcen_sec_d, pcen_sec_f, pcen_loc_loc_w, pcen_loc_loc_d, pcen_loc_loc_f, pcen_loc_w, pcen_loc_d, pcen_loc_f, pcen_og_w, pcen_og_d, pcen_og_f, pcen_og2_w, pcen_og2_d, pcen_og2_f);549if (result === __params__.model) { return { "model": __params__.model, "result": null };}550return {"model": __params__.model, "result": result};551/** * **/552}...
contains.spec.js
Source:contains.spec.js
1/* This Source Code Form is subject to the terms of the Mozilla Public2 * License, v. 2.0. If a copy of the MPL was not distributed with this3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */4// @flow5import {6 containsPosition,7 containsLocation,8 nodeContainsPosition,9} from "../utils/contains";10function getTestLoc() {11 return {12 start: {13 line: 10,14 column: 2,15 },16 end: {17 line: 12,18 column: 10,19 },20 };21}22// AstPosition.column is typed as a number, but many parts of this test set it23// to undefined. Using zero instead causes test failures, and allowing it to be24// undefined causes many flow errors in code manipulating AstPosition.25// Fake a coercion of undefined to number as a workaround for now.26function undefinedColumn(): number {27 return (undefined: any);28}29function startPos(lineOffset, columnOffset) {30 const { start } = getTestLoc();31 return {32 line: start.line + lineOffset,33 column: start.column + columnOffset,34 };35}36function endPos(lineOffset, columnOffset) {37 const { end } = getTestLoc();38 return {39 line: end.line + lineOffset,40 column: end.column + columnOffset,41 };42}43function startLine(lineOffset = 0) {44 const { start } = getTestLoc();45 return {46 line: start.line + lineOffset,47 column: undefinedColumn(),48 };49}50function endLine(lineOffset = 0) {51 const { end } = getTestLoc();52 return {53 line: end.line + lineOffset,54 column: undefinedColumn(),55 };56}57function testContains(pos, bool) {58 const loc = getTestLoc();59 expect(containsPosition(loc, pos)).toEqual(bool);60}61function testContainsPosition(pos, bool) {62 const loc = getTestLoc();63 expect(nodeContainsPosition({ loc }, pos)).toEqual(bool);64}65describe("containsPosition", () => {66 describe("location and postion both with the column criteria", () => {67 it("should contain position within the location range", () =>68 testContains(startPos(1, 1), true));69 it("should not contain position out of the start line", () =>70 testContains(startPos(-1, 0), false));71 it("should not contain position out of the start column", () =>72 testContains(startPos(0, -1), false));73 it(`should contain position on the same start line and74 within the start column`, () => testContains(startPos(0, 1), true));75 it("should not contain position out of the end line", () =>76 testContains(endPos(1, 0), false));77 it("should not contain position out of the end column", () =>78 testContains(endPos(0, 1), false));79 // eslint-disable-next-line max-len80 it("should contain position on the same end line and within the end column", () =>81 testContains(endPos(0, -1), true));82 });83 describe("position without the column criterion", () => {84 it("should contain position on the same start line", () =>85 testContains(startLine(0), true));86 it("should contain position on the same end line", () =>87 testContains(endLine(0), true));88 });89 describe("location without the column criterion", () => {90 it("should contain position on the same start line", () => {91 const loc = getTestLoc();92 loc.start.column = undefinedColumn();93 const pos = {94 line: loc.start.line,95 column: 1,96 };97 expect(containsPosition(loc, pos)).toEqual(true);98 });99 it("should contain position on the same end line", () => {100 const loc = getTestLoc();101 loc.end.column = undefinedColumn();102 const pos = {103 line: loc.end.line,104 column: 1,105 };106 expect(containsPosition(loc, pos)).toEqual(true);107 });108 });109 describe("location and postion both without the column criterion", () => {110 it("should contain position on the same start line", () => {111 const loc = getTestLoc();112 loc.start.column = undefinedColumn();113 const pos = startLine();114 expect(containsPosition(loc, pos)).toEqual(true);115 });116 it("should contain position on the same end line", () => {117 const loc = getTestLoc();118 loc.end.column = undefinedColumn();119 const pos = endLine();120 expect(containsPosition(loc, pos)).toEqual(true);121 });122 });123});124describe("containsLocation", () => {125 describe("locations both with the column criteria", () => {126 it("should contian location within the range", () => {127 const locA = getTestLoc();128 const locB = {129 start: startPos(1, 1),130 end: endPos(-1, -1),131 };132 expect(containsLocation(locA, locB)).toEqual(true);133 });134 it("should not contian location out of the start line", () => {135 const locA = getTestLoc();136 const locB = getTestLoc();137 locB.start.line--;138 expect(containsLocation(locA, locB)).toEqual(false);139 });140 it("should not contian location out of the start column", () => {141 const locA = getTestLoc();142 const locB = getTestLoc();143 locB.start.column--;144 expect(containsLocation(locA, locB)).toEqual(false);145 });146 it("should not contian location out of the end line", () => {147 const locA = getTestLoc();148 const locB = getTestLoc();149 locB.end.line++;150 expect(containsLocation(locA, locB)).toEqual(false);151 });152 it("should not contian location out of the end column", () => {153 const locA = getTestLoc();154 const locB = getTestLoc();155 locB.end.column++;156 expect(containsLocation(locA, locB)).toEqual(false);157 });158 it(`should contain location on the same start line and159 within the start column`, () => {160 const locA = getTestLoc();161 const locB = {162 start: startPos(0, 1),163 end: endPos(-1, -1),164 };165 expect(containsLocation(locA, locB)).toEqual(true);166 });167 it(`should contain location on the same end line and168 within the end column`, () => {169 const locA = getTestLoc();170 const locB = {171 start: startPos(1, 1),172 end: endPos(0, -1),173 };174 expect(containsLocation(locA, locB)).toEqual(true);175 });176 });177 describe("location A without the column criterion", () => {178 it("should contain location on the same start line", () => {179 const locA = getTestLoc();180 locA.start.column = undefinedColumn();181 const locB = getTestLoc();182 expect(containsLocation(locA, locB)).toEqual(true);183 });184 it("should contain location on the same end line", () => {185 const locA = getTestLoc();186 locA.end.column = undefinedColumn();187 const locB = getTestLoc();188 expect(containsLocation(locA, locB)).toEqual(true);189 });190 });191 describe("location B without the column criterion", () => {192 it("should contain location on the same start line", () => {193 const locA = getTestLoc();194 const locB = getTestLoc();195 locB.start.column = undefinedColumn();196 expect(containsLocation(locA, locB)).toEqual(true);197 });198 it("should contain location on the same end line", () => {199 const locA = getTestLoc();200 const locB = getTestLoc();201 locB.end.column = undefinedColumn();202 expect(containsLocation(locA, locB)).toEqual(true);203 });204 });205 describe("locations both without the column criteria", () => {206 it("should contain location on the same start line", () => {207 const locA = getTestLoc();208 const locB = getTestLoc();209 locA.start.column = undefinedColumn();210 locB.start.column = undefinedColumn();211 expect(containsLocation(locA, locB)).toEqual(true);212 });213 it("should contain location on the same end line", () => {214 const locA = getTestLoc();215 const locB = getTestLoc();216 locA.end.column = undefinedColumn();217 locB.end.column = undefinedColumn();218 expect(containsLocation(locA, locB)).toEqual(true);219 });220 });221});222describe("nodeContainsPosition", () => {223 describe("node and position both with the column criteria", () => {224 it("should contian position within the range", () =>225 testContainsPosition(startPos(1, 1), true));226 it("should not contian position out of the start line", () =>227 testContainsPosition(startPos(-1, 0), false));228 it("should not contian position out of the start column", () =>229 testContainsPosition(startPos(0, -1), false));230 it("should not contian position out of the end line", () =>231 testContainsPosition(endPos(1, 0), false));232 it("should not contian position out of the end column", () =>233 testContainsPosition(endPos(0, 1), false));234 it(`should contain position on the same start line and235 within the start column`, () =>236 testContainsPosition(startPos(0, 1), true));237 it(`should contain position on the same end line and238 within the end column`, () =>239 testContainsPosition(endPos(0, -1), true));240 });241 describe("node without the column criterion", () => {242 it("should contain position on the same start line", () => {243 const loc = getTestLoc();244 loc.start.column = undefinedColumn();245 const pos = startPos(0, -1);246 expect(nodeContainsPosition({ loc }, pos)).toEqual(true);247 });248 it("should contain position on the same end line", () => {249 const loc = getTestLoc();250 loc.end.column = undefinedColumn();251 const pos = startPos(0, 1);252 expect(nodeContainsPosition({ loc }, pos)).toEqual(true);253 });254 });255 describe("position without the column criterion", () => {256 it("should contain position on the same start line", () =>257 testContainsPosition(startLine(), true));258 it("should contain position on the same end line", () =>259 testContainsPosition(endLine(), true));260 });261 describe("node and position both without the column criteria", () => {262 it("should contain position on the same start line", () => {263 const loc = getTestLoc();264 loc.start.column = undefinedColumn();265 const pos = startLine();266 expect(nodeContainsPosition({ loc }, pos)).toEqual(true);267 });268 it("should contain position on the same end line", () => {269 const loc = getTestLoc();270 loc.end.column = undefinedColumn();271 const pos = endLine();272 expect(nodeContainsPosition({ loc }, pos)).toEqual(true);273 });274 });...
getters.js
Source:getters.js
1// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.2// This code is governed by the BSD license found in the LICENSE file.3/*---4esid: sec-intl.locale5description: >6 Verifies getters with normal tags.7info: |8 Intl.Locale.prototype.toString ()9 3. Return loc.[[Locale]].10 get Intl.Locale.prototype.baseName11 5. Return the substring of locale corresponding to the12 language ["-" script] ["-" region] *("-" variant)13 subsequence of the langtag grammar.14 get Intl.Locale.prototype.language15 4. Return the substring of locale corresponding to the language production.16 get Intl.Locale.prototype.script17 7. Return the substring of locale corresponding to the script production.18 get Intl.Locale.prototype.region19 7. Return the substring of locale corresponding to the region production.20 get Intl.Locale.prototype.calendar21 3. Return loc.[[Calendar]].22 get Intl.Locale.prototype.collation23 3. Return loc.[[Collation]].24 get Intl.Locale.prototype.hourCycle25 3. Return loc.[[HourCycle]].26 get Intl.Locale.prototype.caseFirst27 This property only exists if %Locale%.[[RelevantExtensionKeys]] contains "kf".28 3. Return loc.[[CaseFirst]].29 get Intl.Locale.prototype.numeric30 This property only exists if %Locale%.[[RelevantExtensionKeys]] contains "kn".31 3. Return loc.[[Numeric]].32 get Intl.Locale.prototype.numberingSystem33 3. Return loc.[[NumberingSystem]].34features: [Intl.Locale]35---*/36// Test all getters return the expected results.37var langtag = "de-latn-de-u-ca-gregory-co-phonebk-hc-h23-kf-true-kn-false-nu-latn";38var loc = new Intl.Locale(langtag);39assert.sameValue(loc.toString(), "de-Latn-DE-u-ca-gregory-co-phonebk-hc-h23-kf-kn-false-nu-latn");40assert.sameValue(loc.baseName, "de-Latn-DE");41assert.sameValue(loc.language, "de");42assert.sameValue(loc.script, "Latn");43assert.sameValue(loc.region, "DE");44assert.sameValue(loc.calendar, "gregory");45assert.sameValue(loc.collation, "phonebk");46assert.sameValue(loc.hourCycle, "h23");47if ("caseFirst" in loc) {48 assert.sameValue(loc.caseFirst, "");49}50if ("numeric" in loc) {51 assert.sameValue(loc.numeric, false);52}53assert.sameValue(loc.numberingSystem, "latn");54// Replace all components through option values and validate the getters still55// return the expected results.56var loc = new Intl.Locale(langtag, {57 language: "ja",58 script: "jpan",59 region: "jp",60 calendar: "japanese",61 collation: "search",62 hourCycle: "h24",63 caseFirst: "false",64 numeric: "true",65 numberingSystem: "jpanfin",66});67assert.sameValue(loc.toString(), "ja-Jpan-JP-u-ca-japanese-co-search-hc-h24-kf-false-kn-nu-jpanfin");68assert.sameValue(loc.baseName, "ja-Jpan-JP");69assert.sameValue(loc.language, "ja");70assert.sameValue(loc.script, "Jpan");71assert.sameValue(loc.region, "JP");72assert.sameValue(loc.calendar, "japanese");73assert.sameValue(loc.collation, "search");74assert.sameValue(loc.hourCycle, "h24");75if ("caseFirst" in loc) {76 assert.sameValue(loc.caseFirst, "false");77}78if ("numeric" in loc) {79 assert.sameValue(loc.numeric, true);80}81assert.sameValue(loc.numberingSystem, "jpanfin");82// Replace only some components through option values and validate the getters83// return the expected results.84var loc = new Intl.Locale(langtag, {85 language: "fr",86 region: "ca",87 collation: "standard",88 hourCycle: "h11",89});90assert.sameValue(loc.toString(), "fr-Latn-CA-u-ca-gregory-co-standard-hc-h11-kf-kn-false-nu-latn");91assert.sameValue(loc.baseName, "fr-Latn-CA");92assert.sameValue(loc.language, "fr");93assert.sameValue(loc.script, "Latn");94assert.sameValue(loc.region, "CA");95assert.sameValue(loc.calendar, "gregory");96assert.sameValue(loc.collation, "standard");97assert.sameValue(loc.hourCycle, "h11");98if ("caseFirst" in loc) {99 assert.sameValue(loc.caseFirst, "");100}101if ("numeric" in loc) {102 assert.sameValue(loc.numeric, false);103}104assert.sameValue(loc.numberingSystem, "latn");...
leap.js
Source:leap.js
1/**2 * Copyright (c) 2014-present, Facebook, Inc.3 *4 * This source code is licensed under the MIT license found in the5 * LICENSE file in the root directory of this source tree.6 */7import assert from "assert";8import { Emitter } from "./emit";9import { inherits } from "util";10import { getTypes } from "./util";11function Entry() {12 assert.ok(this instanceof Entry);13}14function FunctionEntry(returnLoc) {15 Entry.call(this);16 getTypes().assertLiteral(returnLoc);17 this.returnLoc = returnLoc;18}19inherits(FunctionEntry, Entry);20exports.FunctionEntry = FunctionEntry;21function LoopEntry(breakLoc, continueLoc, label) {22 Entry.call(this);23 const t = getTypes();24 t.assertLiteral(breakLoc);25 t.assertLiteral(continueLoc);26 if (label) {27 t.assertIdentifier(label);28 } else {29 label = null;30 }31 this.breakLoc = breakLoc;32 this.continueLoc = continueLoc;33 this.label = label;34}35inherits(LoopEntry, Entry);36exports.LoopEntry = LoopEntry;37function SwitchEntry(breakLoc) {38 Entry.call(this);39 getTypes().assertLiteral(breakLoc);40 this.breakLoc = breakLoc;41}42inherits(SwitchEntry, Entry);43exports.SwitchEntry = SwitchEntry;44function TryEntry(firstLoc, catchEntry, finallyEntry) {45 Entry.call(this);46 const t = getTypes();47 t.assertLiteral(firstLoc);48 if (catchEntry) {49 assert.ok(catchEntry instanceof CatchEntry);50 } else {51 catchEntry = null;52 }53 if (finallyEntry) {54 assert.ok(finallyEntry instanceof FinallyEntry);55 } else {56 finallyEntry = null;57 }58 // Have to have one or the other (or both).59 assert.ok(catchEntry || finallyEntry);60 this.firstLoc = firstLoc;61 this.catchEntry = catchEntry;62 this.finallyEntry = finallyEntry;63}64inherits(TryEntry, Entry);65exports.TryEntry = TryEntry;66function CatchEntry(firstLoc, paramId) {67 Entry.call(this);68 const t = getTypes();69 t.assertLiteral(firstLoc);70 t.assertIdentifier(paramId);71 this.firstLoc = firstLoc;72 this.paramId = paramId;73}74inherits(CatchEntry, Entry);75exports.CatchEntry = CatchEntry;76function FinallyEntry(firstLoc, afterLoc) {77 Entry.call(this);78 const t = getTypes();79 t.assertLiteral(firstLoc);80 t.assertLiteral(afterLoc);81 this.firstLoc = firstLoc;82 this.afterLoc = afterLoc;83}84inherits(FinallyEntry, Entry);85exports.FinallyEntry = FinallyEntry;86function LabeledEntry(breakLoc, label) {87 Entry.call(this);88 const t = getTypes();89 t.assertLiteral(breakLoc);90 t.assertIdentifier(label);91 this.breakLoc = breakLoc;92 this.label = label;93}94inherits(LabeledEntry, Entry);95exports.LabeledEntry = LabeledEntry;96function LeapManager(emitter) {97 assert.ok(this instanceof LeapManager);98 assert.ok(emitter instanceof Emitter);99 this.emitter = emitter;100 this.entryStack = [new FunctionEntry(emitter.finalLoc)];101}102let LMp = LeapManager.prototype;103exports.LeapManager = LeapManager;104LMp.withEntry = function(entry, callback) {105 assert.ok(entry instanceof Entry);106 this.entryStack.push(entry);107 try {108 callback.call(this.emitter);109 } finally {110 let popped = this.entryStack.pop();111 assert.strictEqual(popped, entry);112 }113};114LMp._findLeapLocation = function(property, label) {115 for (let i = this.entryStack.length - 1; i >= 0; --i) {116 let entry = this.entryStack[i];117 let loc = entry[property];118 if (loc) {119 if (label) {120 if (entry.label &&121 entry.label.name === label.name) {122 return loc;123 }124 } else if (entry instanceof LabeledEntry) {125 // Ignore LabeledEntry entries unless we are actually breaking to126 // a label.127 } else {128 return loc;129 }130 }131 }132 return null;133};134LMp.getBreakLoc = function(label) {135 return this._findLeapLocation("breakLoc", label);136};137LMp.getContinueLoc = function(label) {138 return this._findLeapLocation("continueLoc", label);...
formatLocation.js
Source:formatLocation.js
1/*2 MIT License http://www.opensource.org/licenses/mit-license.php3 Author Tobias Koppers @sokra4*/5"use strict";6/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */7/** @typedef {import("./Dependency").SourcePosition} SourcePosition */8// TODO webpack 5: pos must be SourcePosition9/**10 * @param {SourcePosition|DependencyLocation|string} pos position11 * @returns {string} formatted position12 */13const formatPosition = pos => {14 if (pos === null) return "";15 // TODO webpack 5: Simplify this16 if (typeof pos === "string") return pos;17 if (typeof pos === "number") return `${pos}`;18 if (typeof pos === "object") {19 if ("line" in pos && "column" in pos) {20 return `${pos.line}:${pos.column}`;21 } else if ("line" in pos) {22 return `${pos.line}:?`;23 } else if ("index" in pos) {24 // TODO webpack 5 remove this case25 return `+${pos.index}`;26 } else {27 return "";28 }29 }30 return "";31};32// TODO webpack 5: loc must be DependencyLocation33/**34 * @param {DependencyLocation|SourcePosition|string} loc location35 * @returns {string} formatted location36 */37const formatLocation = loc => {38 if (loc === null) return "";39 // TODO webpack 5: Simplify this40 if (typeof loc === "string") return loc;41 if (typeof loc === "number") return `${loc}`;42 if (typeof loc === "object") {43 if ("start" in loc && loc.start && "end" in loc && loc.end) {44 if (45 typeof loc.start === "object" &&46 typeof loc.start.line === "number" &&47 typeof loc.end === "object" &&48 typeof loc.end.line === "number" &&49 typeof loc.end.column === "number" &&50 loc.start.line === loc.end.line51 ) {52 return `${formatPosition(loc.start)}-${loc.end.column}`;53 } else {54 return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;55 }56 }57 if ("start" in loc && loc.start) {58 return formatPosition(loc.start);59 }60 if ("name" in loc && "index" in loc) {61 return `${loc.name}[${loc.index}]`;62 }63 if ("name" in loc) {64 return loc.name;65 }66 return formatPosition(loc);67 }68 return "";69};...
Using AI Code Generation
1var stryker = require('stryker-parent');2console.log(stryker.loc());3{4 "dependencies": {5 }6}
Using AI Code Generation
1var stryker = require('stryker-parent');2console.log(stryker.loc('test.js'));3var stryker = require('stryker-parent');4console.log(stryker.loc('test.js'));5var stryker = require('stryker-parent');6console.log(stryker.loc('test.js'));7var stryker = require('stryker-parent');8console.log(stryker.loc('test.js'));9var stryker = require('stryker-parent');10console.log(stryker.loc('test.js'));11var stryker = require('stryker-parent');12console.log(stryker.loc('test.js'));13var stryker = require('stryker-parent');14console.log(stryker.loc('test.js'));15var stryker = require('stryker-parent');16console.log(stryker.loc('test.js'));17var stryker = require('stryker-parent');18console.log(stryker.loc('test.js'));19var stryker = require('stryker-parent');20console.log(stryker.loc('test.js'));21var stryker = require('stryker-parent');22console.log(stryker.loc('test.js'));23var stryker = require('stryker-parent');24console.log(stryker.loc('test.js'));25var stryker = require('stryker-parent');26console.log(stryker.loc('test.js'));
Using AI Code Generation
1var strykerParent = require('stryker-parent');2var strykerParentLoc = strykerParent.loc;3var strykerLoc = strykerParentLoc('test.js');4var strykerLoc = require('stryker-parent').loc('test.js');5var strykerLoc = require('stryker-parent/loc')('test.js');6var strykerLoc = require('stryker-parent').loc;7strykerLoc('test.js');8var strykerLoc = require('stryker-parent/loc');9strykerLoc('test.js');10var strykerLoc = require('stryker-parent');11strykerLoc.loc('test.js');
Using AI Code Generation
1const strykerParent = require('stryker-parent');2const str = 'Hello World!';3console.log(str.loc);4const strykerParent = require('stryker-parent');5const str = 'Hello World!';6console.log(str.loc);7const strykerParent = require('stryker-parent');8const str = 'Hello World!';9console.log(str.loc);10const strykerParent = require('stryker-parent');11const str = 'Hello World!';12console.log(str.loc);13const strykerParent = require('stryker-parent');14const str = 'Hello World!';15console.log(str.loc);16const strykerParent = require('stryker-parent');17const str = 'Hello World!';18console.log(str.loc);19const strykerParent = require('stryker-parent');20const str = 'Hello World!';21console.log(str.loc);22const strykerParent = require('stryker-parent');23const str = 'Hello World!';24console.log(str.loc);25const strykerParent = require('stryker-parent');26const str = 'Hello World!';27console.log(str.loc);28const strykerParent = require('stryker-parent');29const str = 'Hello World!';30console.log(str.loc);31const strykerParent = require('stryker-parent');32const str = 'Hello World!';33console.log(str.loc);34const strykerParent = require('stryker-parent');35const str = 'Hello World!';36console.log(str.loc);
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!