1import{S as ft,i as ht,s as bt,z as mt,d as k,e as a,f as r,A as _t,k as E,l as n,m as u,n as o,j as l,o as c,C as vt,p as Z,q as e,V as j,F as ie,W as q,t as yt,b as kt,D as Et,I as Pt,r as We,y as dt}from"../chunks/index.bd0d3ab8.js";import{P as St}from"../chunks/ProjectHeader.01831fe7.js";function wt(d){let t,p,s,f,m,h;return{c(){t=a("span"),p=r("Intersection at ("),s=r(d[4]),f=r(", "),m=r(d[5]),h=r(")")},l(P){t=n(P,"SPAN",{});var b=u(t);p=o(b,"Intersection at ("),s=o(b,d[4]),f=o(b,", "),m=o(b,d[5]),h=o(b,")"),b.forEach(l)},m(P,b){Z(P,t,b),e(t,p),e(t,s),e(t,f),e(t,m),e(t,h)},p(P,b){b&16&&We(s,P[4]),b&32&&We(m,P[5])},d(P){P&&l(t)}}}function Nt(d){let t,p;return{c(){t=a("span"),p=r(`Slopes are same but y-intercepts are different, so the lines are parallel and therefore 2 never intersect`)},l(s){t=n(s,"SPAN",{});var f=u(t);p=o(f,`Slopes are same but y-intercepts are different, so the lines are parallel and therefore 3 never intersect`),f.forEach(l)},m(s,f){Z(s,t,f),e(t,p)},p:dt,d(s){s&&l(t)}}}function At(d){let t,p,s,f;return{c(){t=a("span"),p=r(`The slopes are different but the y-intercepts are same therefore both lines will intersect 4 at the y-intercept (0, `),s=r(d[2]),f=r(")")},l(m){t=n(m,"SPAN",{});var h=u(t);p=o(h,`The slopes are different but the y-intercepts are same therefore both lines will intersect 5 at the y-intercept (0, `),s=o(h,d[2]),f=o(h,")"),h.forEach(l)},m(m,h){Z(m,t,h),e(t,p),e(t,s),e(t,f)},p(m,h){h&4&&We(s,m[2])},d(m){m&&l(t)}}}function Dt(d){let t,p;return{c(){t=a("span"),p=r(`Both the slopes and the y-intercept are same therefore both lines are the same and will 6 intersect at every point on either line`)},l(s){t=n(s,"SPAN",{});var f=u(t);p=o(f,`Both the slopes and the y-intercept are same therefore both lines are the same and will 7 intersect at every point on either line`),f.forEach(l)},m(s,f){Z(s,t,f),e(t,p)},p:dt,d(s){s&&l(t)}}}function It(d){let t,p,s,f,m,h,P,b,_,w,I,$,A,ee,F,ce,pe,B,ue,U,H,R,de,fe,D,te,he,be,x,me,se,_e,ve,L,ye,C,ke,z,N,ae,Ee,Pe,v,Se,W,we,Ne,Ae,G,De,Ie,J,ge,Be,M,xe,Le,O,Ke,Te,Ve,je,qe,Q,Fe,Ue,X,Ce,He,Y,Re,ne,ze,Ge;t=new St({props:{title:"Intersect Calc",slug:"intersect-calc",description:"Find the intersection point of two lines",keywords:["intersection calculator","calculate intersection of two lines","find out where tw
7o lines intersect"],icon:"img/projects/icons/intersect-calc.png",screenshot:"img/projects/screenshots/intersect-calc.png"}});function Je(i,y){return i[8]?Dt:i[6]?At:i[7]?Nt:wt}let le=Je(d),g=le(d);return{c(){mt(t.$$.fragment),p=k(),s=a("div"),f=a("div"),m=a("span"),h=a("span"),P=r("Line 1 Equation"),b=k(),_=a("label"),w=a("span"),I=r("y ="),$=k(),A=a("input"),ee=k(),F=a("span"),ce=r("x +"),pe=k(),B=a("input"),ue=k(),U=a("div"),H=a("span"),R=a("span"),de=r("Line 2 Equation"),fe=k(),D=a("label"),te=a("span"),he=r("y ="),be=k(),x=a("input"),me=k(),se=a("span"),_e=r("x +"),ve=k(),L=a("input"),ye=k(),C=a("div"),g.c(),ke=k(),z=a("div"),N=a("div"),ae=a("h3"),Ee=r("Formulas"),Pe=k(),v=a("p"),Se=r("The formula for a line is "),W=a("kbd"),we=r("y = mx + b"),Ne=a("br"),Ae=r(` where 8 `),G=a("kbd"),De=r("x"),Ie=r(` 9 and 10 `),J=a("kbd"),ge=r("y"),Be=r(" are coordinates, "),M=a("kbd"),xe=r("m"),Le=r(` is the slope, and 11 `),O=a("kbd"),Ke=r("b"),Te=r(` 12 is the y-intercept.`),Ve=a("br"),je=r(` So to calculate the point where the lines intersect we substitute and 13 get`),qe=k(),Q=a("kbd"),Fe=r("y = m1x+b1 = m2x+b2"),Ue=k(),X=a("kbd"),Ce=r("x = (b1-b2)/(m2-m1)"),He=k(),Y=a("kbd"),Re=r("y = x*m1+b1 = x*m2+b2"),this.h()},l(i){_t(t.$$.fragment,i),p=E(i),s=n(i,"DIV",{class:!0});var y=u(s);f=n(y,"DIV",{});var re=u(f);m=n(re,"SPAN",{class:!0});var Me=u(m);h=n(Me,"SPAN",{class:!0});var Oe=u(h);P=o(Oe,"Line 1 Equation"),Oe.forEach(l),Me.forEach(l),b=E(re),_=n(re,"LABEL",{class:!0});var T=u(_);w=n(T,"SPAN",{});var Qe=u(w);I=o(Qe,"y ="),Qe.forEach(l),$=E(T),A=n(T,"INPUT",{type:!0,placeholder:!0,class:!0}),ee=E(T),F=n(T,"SPAN",{});var Xe=u(F);ce=o(Xe,"x +"),Xe.forEach(l),pe=E(T),B=n(T,"INPUT",{type:!0,placeholder:!0,class:!0}),T.forEach(l),re.forEach(l),ue=E(y),U=n(y,"DIV",{});var oe=u(U);H=n(oe,"SPAN",{class:!0});var Ye=u(H);R=n(Ye,"SPAN",{class:!0});var Ze=u(R);de=o(Ze,"Line 2 Equation"),Ze.forEach(l),Ye.forEach(l),fe=E(oe),D=n(oe,"LABEL",{class:!0});var V=u(D);te=n(V,"SPAN",{});var $e=u(te);he=o($e,"y ="),$e.forEach(l),be=E(V),x=n(V,"INPUT",{type:!0,placeholder:!0,class:!0}),me=E(V),se=n(V,"SPAN",{});var et=u(se);_e=o(et,"x +"),et.forEach(l),ve=E(V),L=n(V,"INPUT",{type:!0,placeholder:!0,class:!0}),V.forEach(l),oe.forEach(l),ye=E(y),C=n(y,"DIV",{class:!0});var tt=u(C);g.l(tt),tt.forEach(l),ke=E(y),z=n(y,"DIV",{class:!0});var st=u(z);N=n(st,"DIV",{class:!0});var K=u(N);ae=n(K,"H3",{});var at=u(ae);Ee=o(at,"Formulas"),at.forEach(l),Pe=E(K),v=n(K,"P",{class:!0});var S=u(v);Se=o(S,"The formula for a line is "),W=n(S,"KBD",{class:!0});var nt=u(W);we=o(nt,"y = mx + b"),nt.forEach(l),Ne=n(S,"BR",{}),Ae=o(S,` where 14 `),G=n(S,"KBD",{class:!0});var lt=u(G);De=o(lt,"x"),lt.forEach(l),Ie=o(S,` 15 and 16 `),J=n(S,"KBD",{class:!0});var rt=u(J);ge=o(rt,"y"),rt.forEach(l),Be=o(S," are coordinates, "),M=n(S,"KBD",{class:!0});var ot=u(M);xe=o(ot,"m"),ot.forEach(l),Le=o(S,` is the slope, and 17 `),O=n(S,"KBD",{class:!0});var it=u(O);Ke=o(it,"b"),it.forEach(l),Te=o(S,` 18 is the y-intercept.`),Ve=n(S,"BR",{}),je=o(S,` So to calculate the point where the lines intersect we substitute and 19 get`),S.forEach(l),qe=E(K),Q=n(K,"KBD",{class:!0});var ct=u(Q);Fe=o(ct,"y = m1x+b1 = m2x+b2"),ct.forEach(l),Ue=E(K),X=n(K,"KBD",{class:!0});var pt=u(X);Ce=o(pt,"x = (b1-b2)/(m2-m1)"),pt.forEach(l),He=E(K),Y=n(K,"KBD",{class:!0});var ut=u(Y);Re=o(ut,"y = x*m1+b1 = x*m2+b2"),ut.forEach(l),K.forEach(l),st.forEach(l),y.forEach(l),this.h()},h(){c(h,"class","label-text"),c(m,"class","label"),c(A,"type","number"),c(A,"placeholder","slope (m)"),c(A,"class","input input-bordered text-center"),c(B,"type","number"),c(B,"placeholder","y-intercept (b)"),c(B,"class","input input-bordered text-center"),c(_,"class","input-group"),c(R,"class","label-text"),c(H,"class","label"),c(x,"type","number"),c(x,"placeholder","slope (m)"),c(x,"class","input input-bordered text-center"),c(L,"type","number"),c(L,"placeholder","y-intercept (b)"),c(L,"class","input input-bordered text-center"),c(D,"class","input-group"),c(C,"class","alert alert-info text-center text-2xl font-bold p-4"),c(W,"class","kbd"),c(G,"class","kbd"),c(J,"class","kbd"),c(M,"class","kbd"),c(O,"class","kbd"),c(v,"class","leading-loose"),c(Q,"class","kbd"),c(X,"class","kbd"),c(Y,"class","kbd"),c(N,"class","grid text-center justify-center w-full"),c(z,"class","alert"),c(s,"class","flex flex-col gap-4")},m(i,y){vt(t,i,y),Z(i,p,y),Z(i,s,y),e(s,f),e(f,m),e(m,h),e(h,P),e(f,b),e(f,_),e(_,w),e(w,I),e(_,$),e(_,A),j(A,d[0]),e(_,ee),e(_,F),e(F,ce),e(_,pe),e(_,B),j(B,d[2]),e(s,ue),e(s,U),e(U,H),e(H,R),e(R,de),e(U,fe),e(U,D),e(D,te),e(te,he),e(D,be),e(D,x),j(x,d[1]),e(D,me),e(D,se),e(se,_e),e(D,ve),e(D,L),j(L,d[3]),e(s,ye),e(s,C),g.m(C,null),e(s,ke),e(s,z),e(z,N),e(N,ae),e(ae,Ee),e(N,Pe),e(N,v),e(v,Se),e(v,W),e(W,we),e(v,Ne),e(v,Ae),e(v,G),e(G,De),e(v,Ie),e(v,J),e(J,ge),e(v,Be),e(v,M),e(M,xe),e(v,Le),e(v,O),e(O,Ke),e(v,Te),e(v,Ve),e(v,je),e(N,qe),e(N,Q),e(Q,Fe),e(N,Ue),e(N,X),e(X,Ce),e(N,He),e(N,Y),e(Y,Re),ne=!0,ze||(Ge=[ie(A,"input",d[9]),ie(B,"input",d[10]),ie(x,"input",d[11]),ie(L,"input",d[12])],ze=!0)},p(i,[y]){y&1&&q(A.value)!==i[0]&&j(A,i[0]),y&4&&q(B.value)!==i[2]&&j(B,i[2]),y&2&&q(x.value)!==i[1]&&j(x,i[1]),y&8&&q(L.value)!==i[3]&&j(L,i[3]),le===(le=Je(i))&&g?g.p(i,y):(g.d(1),g=le(i),g&&(g.c(),g.m(C,null)))},i(i){ne||(yt(t.$$.fragment,i),ne=!0)},o(i){kt(t.$$.fragment,i),ne=!1},d(i){Et(t,i),i&&l(p),i&&l(s),g.d(),ze=!1,Pt(Ge)}}}function gt(d,t,p){let s,f,m,h,P,b=1,_=1,w=0,I=0;
19function $(){b=q(this.value),p(0,b)}function A(){w=q(this.value),p(2,w)}function ee(){_=q(this.value),p(1,_)}function F(){I=q(this.value),p(3,I)}return d.$$.update=()=>{d.$$.dirty&15&&p(8,s=b===_&&w===I),d.$$.dirty&15&&p(7,f=b===_&&w!==I),d.$$.dirty&12&&p(6,m=w===I),d.$$.dirty&15&&p(4,h=(w-I)/(_-b)),d.$$.dirty&21&&p(5,P=b*h+w)},[b,_,w,I,h,P,m,f,s,$,A,ee,F]}class Lt extends ft{constructor(t){super(),ht(this,t,gt,It,bt,{})}}export{Lt as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.