HEX
Server: Apache
System: Linux vps.mmtprep.com 4.18.0-477.21.1.el8_8.x86_64 #1 SMP Thu Aug 10 13:51:50 EDT 2023 x86_64
User: mmtprep (1001)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/mmtprep/public_html/mathzen.mmtprep.com/assets/GraphicView-GjVClkja.js
var Y=Object.defineProperty;var Q=(h,i,t)=>i in h?Y(h,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[i]=t;var a=(h,i,t)=>(Q(h,typeof i!="symbol"?i+"":i,t),t);import{cA as N,a2 as f,cc as E,ac as M,jS as w,ja as b,as as _,ae as z,jA as k,a3 as O,jT as V,q as C,y as q,u as tt,bt as et,bs as U,c as Z,K as it,C as $,bf as st,bk as nt,jy as ot,o as at,jU as G}from"./index-ajJ0B2-K.js";import{e as v}from"./outilsMathjs-Jea_v8co.js";class X{constructor(){a(this,"r",0);a(this,"x",0);a(this,"y",0);a(this,"theta",0)}getCartesianCoordinates(){return this instanceof K?new d(this.r*Math.cos(this.theta),this.r*Math.sin(this.theta)):this}getPolarCoordinates(){return this instanceof d?new K(Math.sqrt(this.x**2+this.y**2),Math.atan(this.y/this.x)):this}format(){return`(${N(f(this.x,3))}{;}${N(f(this.y,3))})`.replaceAll(",","{,}").replaceAll("{{,}}","{,}")}}class d extends X{constructor(i,t){super(),this.x=i,this.y=t}format(){return`(${N(f(this.x,3))}{;}${N(f(this.y,3))})`.replaceAll(",","{,}").replaceAll("{{,}}","{,}")}}class K extends X{constructor(i,t){super(),this.r=i,this.theta=t}format(){return`(${N(f(this.r,3))}{;}${N(f(this.theta,3))})`.replaceAll(",","{,}").replaceAll("{{,}}","{,}")}}class p{constructor(i,t,e=1,s=""){a(this,"value");a(this,"precision");a(this,"unit");a(this,"toFixed");a(this,"nameAndValue");a(this,"_name");a(this,"calcul");this.value=f(t,e),this.precision=e,this.unit=s,this.toFixed=f(this.value,this.precision),this.name=i}set name(i){typeof i=="string"?this._name=i:this._name=v(i).map(t=>t.name).join(""),this.nameAndValue=`$ {${this.name}=${N(this.toFixed).replace(",","{,}")}~${this.unit.replace("deg","\\degree")}}$`.replace("~\\degree","\\degree")}get name(){return this._name}format(){return`{${N(this.toFixed).replace(",","{,}")}~${this.unit.replace("deg","\\degree")}}`.replace("~\\degree","\\degree")}aleaName(...i){this.name=v(i.map(t=>t instanceof A?t.name:t),i.length).join("")}multiply(i){const t=E([this.name,i.name].filter(s=>s!=="").join("*").replaceAll("{","(").replaceAll("}",")")).toString(),e=M(w(this.toFixed+this.unit).multiply(w(i.toFixed+i.unit)).toString());return new p(t,parseFloat(b(e)?e.toString():e.args[0].toString()),this.precision+i.precision,b(e)?"":e.args[1].toString())}divide(i){const t=E([this.name,i.name].filter(s=>s!=="").join("/").replaceAll("{","(").replaceAll("}",")")).toString(),e=M(w(this.toFixed+this.unit).divide(w(i.toFixed+i.unit)).toString());return new p(t,parseFloat(b(e)?e.toString():e.args[0].toString()),this.precision-i.precision,b(e)?"":e.args[1].toString())}add(i){const t=E([this.name,i.name].filter(s=>s!=="").join("+").replaceAll("{","(").replaceAll("}",")")).toString(),e=M(_(w(this.toFixed+this.unit),w(i.toFixed+i.unit)).toString());return new p(t,parseFloat(b(e)?e.toString():e.args[0].toString()),z(this.precision,i.precision),b(e)?"":e.args[1].toString())}subtract(i){const t=E([this.name,i.name].filter(s=>s!=="").join("-").replaceAll("{","(").replaceAll("}",")")).toString(),e=M(k(w(this.toFixed+this.unit),w(i.toFixed+i.unit)).toString());return new p(t,parseFloat(b(e)?e.toString():e.args[0].toString()),z(this.precision,i.precision),b(e)?"":e.args[1].toString())}hypotenuse(i){return i.pow(2).add(this.pow(2)).sqrt()}pow(i){return new p(this.name+"^{"+i+"}",Math.pow(this.toFixed,i),i*this.precision,this.unit+"^"+i)}sqrt(){return new p("\\sqrt{"+this.name+"}",Math.pow(this.toFixed,.5),Math.floor(.5*this.precision),"cm")}abs(){return new p(this._name,O(this.value),this.precision,this.unit)}neg(){return new p("-"+this.name,-this.value,this.precision,this.unit)}to(i){const t=O(w(this.value,this.unit)),e=O(t.to(i)),s=Math.max(0,this.precision-V(M(e.toString()).args[0].value/M(t.toString()).args[0].value));return new p(this.name,M(e.toString()).args[0].value,s,i)}}function W(h,i=Math.random()*h.length){return typeof h=="string"&&(h=h.split("")),i=parseInt((i%h.length).toString()),h.concat(h).splice(i,h.length)}function J(...h){const i=[],t=[],e=[];for(const r of h)r instanceof l?(i.push(r),t.push(r.x),e.push(r.y)):r instanceof P&&(i.push(...r.vertices),t.push(r.getDimensions()[0],r.getDimensions()[2]),e.push(r.getDimensions()[1],r.getDimensions()[3]));const s=Math.min(...t),n=Math.max(...t),o=Math.min(...e),c=Math.max(...e);return[s,o,n,c]}function F(h,i){return h-h%i}function dt(h,...i){return i=i.map((t,e)=>t instanceof p?String.raw`${h.raw[e]}`+t.name:t instanceof B?String.raw`${h.raw[e]}`+`${t.name}`:t instanceof y?String.raw`${h.raw[e]}`+`${t.name}`:t instanceof l||t instanceof P?String.raw`${h.raw[e]}`+`${t.name}`:String.raw`${h.raw[e]}`+`${t}`),i.join("")+h.raw[h.length-1]}class A{constructor(){a(this,"visible");a(this,"_name");a(this,"color","black");this.visible=!1,this.name=""}aleaName(...i){this.name=v(i.map(t=>t instanceof A?t.name:t),i.length).join("")}set name(i){this._name=i}get name(){return this._name}getGGB(){return this.name}moveRight(...i){const[t,e,s]=J(this),[,n,o,c]=J(...i),r=new l(t,e),m=new l(o,c),u=new g(r,m);this.move(u.add(new g(4,0)).sub(new g(0,(c-n+s-e)/2)))}move(i){if(this instanceof l)this.x=this.add(i).x,this.y=this.add(i).y;else if(this instanceof P)for(const t of this.vertices)t.x=t.add(i).x,t.y=t.add(i).y}}class l extends A{constructor(t,e=0){super();a(this,"coordinates");a(this,"polarCoordinates");a(this,"cartesianCoordinates");a(this,"type");a(this,"x");a(this,"y");a(this,"r");a(this,"theta");a(this,"ggb");a(this,"dot");a(this,"labelPoints");a(this,"label",!1);a(this,"M2D");a(this,"xSVG",function(t){return f(this.x*t,3)});a(this,"ySVG",function(t){return-f(this.y*t,3)});t instanceof X?this.coordinates=t:this.coordinates=new d(t,e),this.polarCoordinates=this.getPolarCoordinates(),this.cartesianCoordinates=this.getCartesianCoordinates(),this.name="",this.type="Point",this.x=this.cartesianCoordinates.x,this.y=this.cartesianCoordinates.y,this.r=this.polarCoordinates.r,this.theta=this.polarCoordinates.theta,this.ggb=`${this.name} = (${this.x},${this.y})`,this.M2D=C(this.x,this.y,"","above right")}getPolarCoordinates(){return this.coordinates.getPolarCoordinates()}getCartesianCoordinates(){return this.coordinates.getCartesianCoordinates()}getRotate(t,e){return new l(new d((this.x-t.x)*Math.cos(e)-(this.y-t.y)*Math.sin(e)+t.x,(this.x-t.x)*Math.sin(e)+(this.y-t.y)*Math.cos(e)+t.y))}add(t){return new l(new d(this.x+t.x,this.y+t.y))}sub(t){return new l(new d(this.x-t.x,this.y-t.y))}multiply(t){return new l(new d(this.x*t,this.y*t))}divide(t){if(t!==0)return new l(new d(this.x/t,this.y/t))}getBarycentriqueCoords(t,e,s){const n=R(e.sub(this),s.sub(this)),o=R(s.sub(this),t.sub(this)),c=R(t.sub(this),e.sub(this));return[n,o,c]}isInTriangle(t,e,s){return Math.min(...this.getBarycentriqueCoords(t,e,s))>0||Math.max(...this.getBarycentriqueCoords(t,e,s))<0}getSymetric(t){return S([this,t],[2,-1])}getHomothetic(t,e){return new l(new d(e*this.x+(1-e)*t.x,e*this.y+(1-e)*t.y))}getVector(){return new g(this.x,this.y)}getGGB(){return this.ggb=`${this.name} = (${this.x},${this.y})`,`${this.name} = (${this.x},${this.y})`}showName(t=1){let e;const s=this.name.split("_"),n=s.length===1?s[0]:`${s[0]}_{${s[1]}}`;if(this.labelPoints!==void 0){const o=this.labelPoints[0],c=this.labelPoints[2],r=this.labelPoints[1],m=o.sub(r).getVector().getNormed(),u=c.sub(r).getVector().getNormed();let x;m.colinear(u)?x=r.add(m.getNormal().multiply(t*.4)):x=r.getSymetric(r.add(m.add(u).getNormed().multiply(t*.4))),e=q(n,x.x,x.y,"black",0,0,"",8),this.labelPoints=[o,r,c]}else e=q(n,this.x,this.y+.2*t,"black",0,0,"",8);return this.label=!0,e}showDot(){const t=this.name.split("_");let e=t.length===1?t[0]:`${t[0]}_{${t[1]}}`;return Z.isHtml&&(e=`$${e}$`),this.dot=tt(C(this.x,this.y,e,"above")),this}set name(t){this._name=t,this.ggb=`${this.name} = (${this.x},${this.y})`}get name(){return this._name}}class g{constructor(i,t){a(this,"x",0);a(this,"y",0);a(this,"norme");typeof i=="number"&&typeof t=="number"?(this.x=i,this.y=t):i instanceof l&&t instanceof l&&(this.x=t.x-i.x,this.y=t.y-i.y),this.norme=Math.sqrt(this.x**2+this.y**2)}getNormed(){const i=Math.sqrt(this.x**2+this.y**2);return new g(this.x/i,this.y/i)}getNormal(){return new g(-this.y,this.x)}add(i){return new g(this.x+i.x,this.y+i.y)}sub(i){return new g(this.x-i.x,this.y-i.y)}multiply(i){return new g(this.x*i,this.y*i)}neg(){return new g(-this.x,-this.y)}dot(i){return et([this.x,this.y],[i.x,i.y])}cross(i){return U([this.x,this.y,0],[i.x,i.y,0])}colinear(i){return parseFloat(U([this.x,this.y,0],[i.x,i.y,0])[2].toFixed(15))===0}}class y extends A{constructor(t,e){super();a(this,"direction");a(this,"A");a(this,"B");a(this,"type");a(this,"a",0);a(this,"b",0);a(this,"c",0);a(this,"ggb");this.direction=e instanceof g?e:new g(e.x-t.x,e.y-t.y),this.A=t,this.B=e instanceof l?e:new l(new d(t.x+e.x,t.y+e.y)),this.getEquation(),this.type="Line",this.ggb=`${this.name}: ${this.a}*x+${this.b}*y=${this.c})`}getYPoint(t){return this.b===0?void 0:(this.c-this.a*t)/this.b}getXPoint(t){return this.a===0?void 0:(this.c-this.b*t)/this.a}getEquation(){const t=this.direction.getNormed();this.a=-t.y,this.b=t.x,this.c=this.a*this.A.x+this.b*this.A.y}getIntersect(t){const e=t.a*this.b-this.a*t.b;if(e.toFixed(15)!=="0"){const s=-(t.b*this.c-this.b*t.c),n=t.a*this.c-this.a*t.c;return new l(new d(s/e,n/e))}}getPerpendicularLine(t){return new y(t,this.direction.getNormal())}getSymetric(t){return S([this.getIntersect(this.getPerpendicularLine(t)),t],[2,-1])}set name(t){this._name=t,this.ggb=`${this.name}: ${this.a}*x+${this.b}*y=${this.c})`}get name(){return this._name}}function R(h,i){return h.x*i.y-h.y*i.x}function S(h,i){if(Array.isArray(h)&&Array.isArray(i)&&h.length===i.length)return h.map((e,s)=>e.multiply(i[s])).reduce((e,s)=>e.add(s)).divide(i.reduce((e,s)=>e+s));window.notify("fonction barycentre() de AleaFigure mal employée",{points:h,coefficients:i})}class B extends y{constructor(t,e){super(t,e);a(this,"label");a(this,"text","");a(this,"textColor","black");a(this,"direct",!0);this.type="Segment",this.A=t,this.B=e,this.aleaName(this.A,this.B),this.getEquation()}showLabel(){let t;const e=new l((this.A.x+this.B.x)/2,(this.A.y+this.B.y)/2);return Z.isHtml?t=q(this.name,e.x,e.y,"black",0,0,""):t=q(this.name,e.x,e.y,"black",0,0,""),this.label=!0,t}}class D extends A{constructor(t,e){super();a(this,"A");a(this,"B");a(this,"type");a(this,"a",0);a(this,"b",0);a(this,"r",0);this.type="Circle",this.A=t,this.B=e instanceof l?e:t,this.r=e instanceof l?Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2):e}getPoint(t){return new l(new d(this.A.x+this.r*Math.cos(t),this.A.y+this.r*Math.sin(t)))}}class H extends A{constructor(t,e,s){super();a(this,"A");a(this,"B");a(this,"C");a(this,"angle");a(this,"type");a(this,"direct");a(this,"vBA");a(this,"vBC");a(this,"right",!1);a(this,"fillColor","none");a(this,"fillOpacity",.2);a(this,"rayon",!0);this.type="Angle";const n=new g(t.x,t.y),o=new g(e.x,e.y),c=new g(s.x,s.y),r=n.sub(o).getNormed(),m=c.sub(o).getNormed();this.vBA=r,this.vBC=m;const u=r.x*m.x+r.y*m.y;this.angle=Math.acos(u),this.A=e.add(r),this.B=e,this.C=e.add(m),this.direct=U([r.x,r.y,0],[m.x,m.y,0])[2]>0}scale(t){const e=this.vBA.multiply(t),s=this.vBC.multiply(t);this.A=this.B.add(e),this.C=this.B.add(s)}}class P extends A{constructor(...t){super();a(this,"showLabels",!0);this.vertices=t,this.name=W(t.map(e=>e.name)).join("")}getDimensions(){const t=this.vertices.map(r=>r.x),e=this.vertices.map(r=>r.y),s=Math.min(...t),n=Math.max(...t),o=Math.min(...e),c=Math.max(...e);return[s,o,n,c]}}class ht extends P{constructor(...t){super(...t);a(this,"longueur");a(this,"largeur");a(this,"ratio");const[e,s,n]=t,o=[Math.sqrt((e.x-s.x)**2+(e.y-s.y)**2),Math.sqrt((n.x-s.x)**2+(n.y-s.y)**2)].sort();this.largeur=o[0],this.longueur=o[1],this.ratio=this.longueur/this.largeur}}class j extends P{constructor(...i){super(...i)}}function rt(h){h.allowResize&&h.resize();const i=20/(h.ppc??20),t={xmin:h.xmin-i,xmax:h.xmax+i,ymin:h.ymin-i,ymax:h.ymax+i},e=[];if(h.clipVisible){const s=it(C(t.xmin,t.ymin,"","above"),C(t.xmax,t.ymin,"","above"),C(t.xmax,t.ymax,"","above"),C(t.xmin,t.ymax,"","above"));s!=null&&e.push(s)}for(const s of h.geometricExport.filter(n=>n.visible))if(s instanceof l){if(s.dot!=null&&e.push(s.dot),s.label){const n=s.showName(i);n!=null&&e.push(n)}}else if(s instanceof y&&!(s instanceof B)){const n=h.getExtremPointGraphicLine(s);n!=null&&Array.isArray(n)&&e.push($(n[0],n[1],s.color??"black"))}else if(s instanceof B){if(s.A!=null&&s.B!=null&&e.push($(s.A,s.B,s.color??"black")),s.label&&s.showLabel(i)!=null&&e.push(),s.text!==""&&s.A.M2D!=null&&s.B.M2D!=null){const n=s.direct?[s.A.M2D,s.B.M2D]:[s.B.M2D,s.A.M2D];e.push(st(s.text,n[0],n[1],s.textColor??"black",.5*i))}}else if(s instanceof D)s.A.M2D!=null&&s.r>0&&e.push(nt(s.A.M2D,s.r));else if(s instanceof H){if(Math.abs(s.angle).toFixed(13)===(Math.PI/2).toFixed(13)&&s.right){const n=s.A,o=s.C,c=s.B;if(n instanceof l&&o instanceof l&&c instanceof l){const r=n.sub(c).getVector().getNormed().multiply(i*.7),m=o.sub(c).getVector().getNormed().multiply(i*.7),u=c.add(r.add(m));u.showDot(),e.push(...h.addSidesPolygon(c,c.add(r),u,c.add(m)).map(x=>$(x.A,x.B,s.color)))}}else if(s instanceof P)s.showLabels&&s.vertices.forEach(n=>{n instanceof l&&e.push(n.showName(i))});else if(s.scale(i),s.A.M2D!=null&&s.C.M2D!=null){const n=s.direct?[s.A.M2D,s.C.M2D]:[s.C.M2D,s.A.M2D];e.push(ot(...n,s.angle/Math.PI*180,s.fillColor!=="none"?s.rayon:!0,s.fillColor??"none",s.color??"black",s.fillOpacity??0))}}else s!=null&&e.push(s);for(const s of h.grid){const n=h.getExtremPointGraphicLine(s);n!==void 0&&e.push($(...n,s.color??"black"))}for(const s of h.axes){const n=h.getExtremPointGraphicLine(s);if(Array.isArray(n)&&n.length>=2){const o=$(...n,s.color??"black");o.styleExtremites="->",e.push(o)}}return at(Object.assign({},{mainlevee:!1,pixelsParCm:h.ppc,scale:h.scale*.7},t),e)}function I(h,i,t=1){const e=[];e.push(G(t,i-(h-1)*t+1));for(let s=1;s<h-1;s++)e.push(G(e[s-1]+t,i-(h-s-1)*t+1));e.push(i);for(let s=h-1;s>0;s--)e[s]=e[s]-e[s-1];return e}class ut{constructor(i=0,t=0,e=10,s=10){a(this,"names");a(this,"ppc");a(this,"scale");a(this,"geometric");a(this,"geometricExport");a(this,"grid");a(this,"axes");a(this,"xmin",0);a(this,"ymin",0);a(this,"xmax",10);a(this,"ymax",10);a(this,"width");a(this,"height");a(this,"ratio");a(this,"clipVisible",!1);a(this,"saveRatio",!0);a(this,"allowResize",!0);a(this,"showLabelPoint",!1);a(this,"limit",1/0);a(this,"_namesAlea",!0);this.setDimensions(i,t,e,s),this.names=v("ABCDEFGHIJKLMNOPRSTUVZ".split("")),this.ppc=20,this.scale=1,this.geometric=[],this.grid=[],this.axes=[]}set namesAlea(i){typeof i=="string"&&(this.names=v(i)),i===!1&&(this.names="ABCDEFGHIJKLMNOPRSTUVZ".split(""))}get namesAlea(){return this.names}setDimensions(i=-5,t=-5,e=5,s=5){this.xmin=i,this.ymin=t,this.xmax=e,this.ymax=s,this.width=this.xmax-this.xmin,this.height=this.ymax-this.ymin,this.ratio=this.height/this.width}show(...i){const t=[];return i.forEach(e=>{Array.isArray(e)?t.push(...e):e instanceof P?(t.push(...e.vertices),t.push(...this.addSidesPolygon(...e.vertices)),this.addLabelsPointsPolygon(...e.vertices)):t.push(e)}),t.forEach(e=>{e.visible=!0}),t}addGrid(i=1){for(let t=this.xmin;t<F(this.width,i);t++){const e=new y(new l(t,0),new g(0,1));e.color="gray",this.grid.push(e)}for(let t=this.ymin;t<F(this.height,i);t++){const e=new y(new l(0,t),new g(1,0));e.color="gray",this.grid.push(e)}}addAxes(){const i=new y(new l(0,0),new g(0,1));this.axes.push(i);const t=new y(new l(0,0),new g(1,0));this.axes.push(t)}getDimensions(...i){const t=this.getListObjectTypeSelect("Point",i),e=t.map(m=>m.x),s=t.map(m=>m.y),n=Math.min(...e),o=Math.max(...e),c=Math.min(...s),r=Math.max(...s);return[n,c,o,r]}getWidth(...i){const[t,,e]=this.getDimensions(...i);return e-t}getHeight(...i){const[,t,,e]=this.getDimensions(...i);return e-t}getUponPoint(...i){const t=this.getListObjectTypeSelect("Point",i);return this.getListObjectTypeSelect("Point",i).sort((e,s)=>s.y-e.y)[t.length-1]}geBelowPoint(...i){return this.getListObjectTypeSelect("Point",i).sort((t,e)=>e.y-t.y)[0]}getLeftPoint(...i){const t=this.getListObjectTypeSelect("Point",i);return this.getListObjectTypeSelect("Point",i).sort((e,s)=>s.x-e.x)[t.length-1]}getRightPoint(...i){return this.getListObjectTypeSelect("Point",i).sort((e,s)=>s.x-e.x)[0]}resize(){const[i,t,e,s]=this.getDimensions(),[n,o]=[e-i,s-t];let c=0+o,r=0+n;const u=o/n/this.ratio;this.saveRatio?u<1?c=o/u:r=n*u:this.ratio=c/r,this.ppc=this.ppc*this.height/c,this.scale=this.scale*this.height/c;const x=(r-n)/2,T=(c-o)/2;this.setDimensions(i-x,t-T,e+x,s+T)}getListObjectTypeSelect(i="Point",t=this.geometric){switch(t.length===0&&(t=this.geometric),i){case"Point":return t.filter(e=>e instanceof l).sort((e,s)=>{const n=e.name.split("_"),o=s.name.split("_");return n[0]===o[0]?parseInt(n[1])-parseInt(o[1]):(-1)**(n[0]>o[0]?0:1)});default:return this.geometric.filter(e=>!(e instanceof l)).sort((e,s)=>{const n=e.name.split("_"),o=s.name.split("_");return n[0]===o[0]?parseInt(n[1])-parseInt(o[1]):(-1)**(n[0]>o[0]?0:1)})}}getLastNameNotUsed(i="Point"){switch(i){case"Point":{const t=this.getListObjectTypeSelect("Point");let e,s=0;do{const n=s===0?"":`_${s}`;e=this.names.find(o=>{var c;return((c=t.filter(r=>r.name[0]===o).find(r=>r.name===o+n))==null?void 0:c.name)!==o+n}),e!==void 0&&(e+=n),s+=1}while(e===void 0);return e}case"Segment":case"Circle":case"Line":{const t=this.getListObjectTypeSelect("Segment").concat(this.getListObjectTypeSelect("Line"));let e,s=0;do{const n=s===0?"":`_${s}`;e=this.names.find(o=>{var c;return((c=t.filter(r=>r.name[0]===o.toLowerCase()).find(r=>r.name===o.toLowerCase()+n))==null?void 0:c.name)!==o.toLowerCase()+n}),e!==void 0&&(e=e.toLowerCase()+n),s+=1}while(e===void 0);return e}}}getNewName(i="Point"){switch(i){case"Point":return this.getLastNameNotUsed(i);case"Segment":case"Circle":case"Line":return this.getLastNameNotUsed(i)}}aleaNameObject(...i){const t=v(i.length);i.forEach((e,s)=>{e.name=t[s]})}addPoint(i=1,t){const e=[];for(let s=0;s<i;s++){let n,o=0;do o+=1,n=new l(new d(t===void 0?Math.random()*this.width+this.xmin:F(Math.random()*this.width+this.xmin,t),t===void 0?Math.random()*this.height+this.ymin:F(Math.random()*this.height+this.ymin,t)));while(o<this.limit&&(this.isCloseToExistingPoints(n)||this.isCloseToLineThroughtExistingPoints(n)));n.name=this.getNewName(n.type),this.showLabelPoint&&(n.showDot(),n.showName()),this.geometric.push(n),e.push(n)}return e}addIntersectLine(i,t){if(i instanceof y&&t instanceof y){const e=i.a*t.b-t.a*i.b;if(e.toFixed(15)!=="0"){const s=-(i.b*t.c-t.b*i.c),n=i.a*t.c-t.a*i.c,o=new l(new d(s/e,n/e));return o.name=this.getNewName(o.type),this.geometric.push(o),[o]}}else if(i instanceof D&&t instanceof D){const e=this.distance(i.A,t.A);if(e>i.r+t.r||e<Math.abs(i.r-t.r))return[];{const s=(i.r**2-t.r**2+e**2)/(2*e),n=Math.sqrt(i.r**2-s**2),o=i.A.x+s*(t.A.x-i.A.x)/e,c=i.A.y+s*(t.A.y-i.A.y)/e,r=o+n*(t.A.y-i.A.y)/e,m=c-n*(t.A.x-i.A.x)/e,u=new l(new d(r,m)),x=o-n*(t.A.y-i.A.y)/e,T=c+n*(t.A.x-i.A.x)/e,L=new l(new d(x,T));return u.name=u.name||this.getNewName(u.type),L.name=L.name||this.getNewName(L.type),this.geometric.push(u,L),[u,L]}}}zoom(i=1.01){const t=i*(this.xmin-(this.xmax+this.xmin)/2)+(this.xmax+this.xmin)/2,e=i*(this.xmax-(this.xmax+this.xmin)/2)+(this.xmax+this.xmin)/2,s=i*(this.ymin-(this.ymax+this.ymin)/2)+(this.ymax+this.ymin)/2,n=i*(this.ymax-(this.ymax+this.ymin)/2)+(this.ymax+this.ymin)/2;this.setDimensions(t,s,e,n)}distance(i,t){return t instanceof l?Math.sqrt((i.x-t.x)**2+(i.y-t.y)**2):Math.abs(t.a*i.x+t.b*i.y-t.c)/Math.sqrt(t.a**2+t.b**2)}isCloseToExistingPoints(i){const t=this.getListObjectTypeSelect("Point"),e=Math.min(this.height,this.width)/t.length/3;return t.length>0?t.some(s=>this.distance(s,i)<e):!1}isCloseToLineThroughtExistingPoints(i){const t=this.getListObjectTypeSelect("Point"),e=this.getListObjectTypeSelect("Line"),s=t.length+e.length,n=[],o=Math.min(this.height,this.width)/s/3;for(let c=0;c<t.length;c++)for(let r=c+1;r<t.length;r++){const m=new y(t[c],t[r]);n.push(this.distance(i,m))}for(let c=0;c<e.length;c++)n.push(this.distance(i,e[c]));return n.some(c=>c<o&&parseFloat(c.toFixed(15))!==0)}addLine(i=this.addPoint()[0],t=this.addPoint()[0]){const e=new y(i,t);return e.name=this.getNewName(e.type),this.geometric.push(e),e}addSegment(i=this.addPoint()[0],t=this.addPoint()[0]){const e=new B(i,t);return this.geometric.push(e),e}addCircle(i=this.addPoint()[0],t){const e=new D(i,t);return e.name=this.getNewName(e.type),this.geometric.push(e),e}getExtremPointGraphicLine(i){const t=[[i.getXPoint(this.ymin),this.ymin],[i.getXPoint(this.ymax),this.ymax]],e=[[this.xmin,i.getYPoint(this.xmin)],[this.xmax,i.getYPoint(this.xmax)]],s=[];for(const n of t)n.every(o=>o!==void 0)&&n[0]>=this.xmin&&n[0]<=this.xmax&&s.push(n);for(const n of e)n.every(o=>o!==void 0)&&n[1]>=this.ymin&&n[1]<=this.ymax&&s.push(n);if(s.length===2)return[new l(new d(s[0][0],s[0][1])),new l(new d(s[1][0],s[1][1]))]}getNewPointBetween(i,t){const e=Math.random();return new l(new d((i.x-t.x)*e+t.x,(i.y-t.y)*e+t.y))}addPointBetween(i,t){const e=I(2,100,15),s=S([i,t],e);return s.name=s.name||this.getNewName(s.type),this.geometric.push(s),s}addPointDistance(i,t){let e;const s=new D(i,t);do{const n=Math.random()*Math.PI*2;e=s.getPoint(n)}while(this.isCloseToExistingPoints(e)||this.isCloseToLineThroughtExistingPoints(e));return e.name=this.getNewName(e.type),this.geometric.push(e),e}addPointInPolygon(...i){const t=I(i.length,100,60/i.length),e=S(i,t);return e.name=e.name||this.getNewName(e.type),this.geometric.push(e),e}addPointOutPolygon(...i){const t=I(i.length,100,60/i.length),e=Math.round(Math.random()*(t.length-2)),s=new y(i[e],i[e+1]).getSymetric(S(i,t));return s.name=s.name||this.getNewName(s.type),this.geometric.push(s),s}addPointOnPolygon(...i){const t=I(2,100,30),e=S(W(i).slice(0,2),t);return e.name=e.name||this.getNewName(e.type),this.geometric.push(e),e}placeLabelsPolygon(...i){for(let t=1;t<i.length+1;t++){const e=[i[i.length-1]].concat(i).concat([i[0]]);e[t].showName(),e[t].labelPoints=[e[t-1],e[t],e[t+1]]}}addSymetric(i,...t){return t.map(e=>{const s=i.getSymetric(e);return s.name=s.name||this.getNewName(s.type),this.geometric.push(s),s})}addTranslate(i,...t){return t.map(e=>{const s=e.add(i);return s.name=s.name||this.getNewName(s.type),this.geometric.push(s),s})}move(i,...t){for(const e of t)e.x=e.add(i).x,e.y=e.add(i).y}addPointAligned(i=this.addPoint()[0],t=this.addPoint()[0]){let e;do{const s=new y(i,t),[n,o]=this.getExtremPointGraphicLine(s);e=this.getNewPointBetween(n,o)}while(this.isCloseToExistingPoints(e)||this.isCloseToLineThroughtExistingPoints(e));return e.name=e.name||this.getNewName(e.type),this.geometric.push(e),[i,t,e]}addRectPoint(...i){let t,e,s;do{if(e!==void 0)for(let r=0;r<2-i.length;r++)this.geometric.pop(),this.geometric.pop();[e,s]=i.concat(this.addPoint(2-i.length));const n=new y(e,s).getPerpendicularLine(e),[o,c]=this.getExtremPointGraphicLine(n);t=this.getNewPointBetween(o,c)}while(this.isCloseToExistingPoints(t)||this.isCloseToLineThroughtExistingPoints(t));return t.name=t.name||this.getNewName(t.type),this.geometric.push(t),[e,s,t]}distanceMinSidesVertices(i,t,e){return Math.min(this.distance(i,new y(t,e)),this.distance(t,new y(i,e)),this.distance(e,new y(i,t)))}addNotAlignedPoint(i=this.addPoint()[0],t=this.addPoint()[0],e){const s=Math.min(this.height,this.width)/this.getListObjectTypeSelect("Point").length/3;do e!==void 0&&this.geometric.pop(),e=this.addPoint()[0];while(this.distanceMinSidesVertices(i,t,e)<s);return e.name=e.name||this.getNewName(e.type),[i,t,e]}addParallelLine(i=this.addPoint()[0],t=this.addLine()){const e=new y(i,t.direction);return e.name=this.getNewName(e.type),this.geometric.push(e,i,t),[t,e]}addPerpendicularLine(i=this.addPoint()[0],t=this.addLine()){const e=new y(i,t.direction.getNormal());return e.name=this.getNewName(e.type),this.geometric.push(e),[t,e]}addSidesPolygon(...i){const t=[];for(let e=0;e<i.length-1;e++)t.push(this.addSegment(i[e],i[e+1]));return t.push(this.addSegment(i[i.length-1],i[0])),t}addLabelsPointsPolygon(...i){const t=i.length-1,e=[i[t]].concat(i).concat(i[0]);for(let s=1;s<i.length+1;s++)e[s].labelPoints=[e[s-1],e[s],e[s+1]],e[s].showName(1.3)}addTriangle(i,t,e,s){let n;if(i instanceof l&&t!==void 0&&t instanceof l&&e instanceof l)n=new j(i,t,e);else if(i instanceof l&&t instanceof l&&e instanceof l)n=new j(...this.addNotAlignedPoint(...[i,t,e].filter(o=>o!==void 0)));else if(i instanceof l&&typeof t=="number"&&e instanceof l&&typeof s=="number"){const o=this.addCircle(i,t),c=this.addCircle(e,s),[r]=this.addIntersectLine(o,c);n=new j(i,e,r)}else if(typeof i=="number"&&typeof t=="number"&&typeof e=="number"){const o=this.addPoint()[0],c=this.addPointDistance(o,i),r=this.addCircle(o,t),m=this.addCircle(c,e),[u]=this.addIntersectLine(r,m);n=new j(o,c,u)}else i===void 0&&(n=new j(...this.addNotAlignedPoint()));return n}addParallelogram(i=this.addPoint()[0],t=this.addPoint()[0],e=this.addNotAlignedPoint(i,t)[2],s=void 0){return s=new l(new d(i.x+e.x-t.x,i.y+e.y-t.y)),s.name=s.name||this.getNewName(s.type),this.geometric.push(s),new P(i,t,e,s)}addRegularPolygon(i,t=this.addPoint()[0],e=this.addPoint()[0]){const s=[t,e];for(let n=2;n<i;n++){const o=s[n-2].getRotate(s[n-1],Math.PI-2*Math.PI/i);o.name=o.name||this.getNewName(o.type),this.geometric.push(o),s.push(o)}return new P(...s)}addRectangle(i){let t;if(i==null)do{t!==void 0&&(this.geometric.pop(),this.geometric.pop(),this.geometric.pop(),this.geometric.pop());const[e,s,n]=this.addRectPoint(),o=this.addParallelogram(n,e,s).vertices[3];t=new ht(e,s,o,n)}while(t.ratio<1.2||t.ratio>1.7);return t}addRegularPolygonCenter(i=this.addPoint()[0],t=this.addPoint()[0],e){const s=Math.PI*(.5-1/e),n=1/(2*Math.sin(Math.PI/e)),o=new l(new d(((i.x-t.x)*Math.cos(s)-(i.y-t.y)*Math.sin(s))*n+t.x,((i.x-t.x)*Math.sin(s)+(i.y-t.y)*Math.cos(s))*n+t.y));return o.name=o.name||this.getNewName(o.type),this.geometric.push(o),o}addHomothetic(i,t,...e){const s=[];return e.map(n=>{const o=new l(new d(t*n.x+(1-t)*i.x,t*n.y+(1-t)*i.y));return o.name=o.name||this.getNewName(o.type),this.geometric.push(o),s.push(o),o}),s}addAngle(i,t,e){const s=new H(i,t,e);return this.geometric.push(s),s}addAnglesPolygon(...i){const t=i.length-1,e=[i[t]].concat(i).concat(i[0]),s=[];for(let n=1;n<i.length+1;n++){const o=new H(e[n-1],e[n],e[n+1]);s.push(o),this.geometric.push(o)}return s}addRotate(i,t,...e){const s=[];return e.map(n=>{const o=new l(new d((n.x-i.x)*Math.cos(t)-(n.y-i.y)*Math.sin(t)+i.x,(n.x-i.x)*Math.sin(t)+(n.y-i.y)*Math.cos(t)+i.y));return o.name=o.name||this.getNewName(o.type),this.geometric.push(o),s.push(o),o}),s}exportGGB(i=this.geometric){const t=[];return i.forEach(e=>{t.push(e.getGGB())}),t.join(`
`)}getFigure(...i){return this.geometricExport=this.show(...i),rt(this)}}export{ut as G,g as a,y as b,l as c,p as d,W as e,B as f,dt as n};
//# sourceMappingURL=GraphicView-GjVClkja.js.map