Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HELLO, in windows application form i need some codes. imagine we have to line with this formulas:
Ax + By + C = 0 & A'x + B'y + C' = 0
i want to find x & y if they have Collision.
Posted
Updated 19-Jan-13 2:37am
v2
Comments
Valery Possoz 19-Jan-13 8:51am    
http://www.codeproject.com/Articles/277547/Solve-Linear-and-Polynomial-Equations
Sergey Alexandrovich Kryukov 19-Jan-13 22:58pm    
Not a question. Trivial issue. Not even programming, just elementary middle school mathematics. Problems? There are some textbooks around...
—SA

it is very easy, use matrices to solve these equations.

http://www.mathsisfun.com/algebra/systems-linear-equations-matrices.html[^]
C#
Another way:
1)Ax+By+C=0
2)A'x+B'y+C'=0
------------------------------
1)x=(-By+C)/A
2)-A'*((-By+C)/A)-C'=B'y
---------------------------------
2)((A'*B)/A)y+((-A'*C)/A)-C'=B'y
-----------------------------------
2)y(((A'*B)/A)-B')=((A'*C)/A)+C'
-----------------------------------
2)y=(((A'*C)/A)+C')/(((A'*B)/A)-B')


finding x will not be that difficult.
 
Share this answer
 
v5
Comments
keivan ahmadian 19-Jan-13 10:05am    
string name;
double x;
double y;

public string Name
{
get
{
return name;
}
set
{
name = value;
}
}

public double X
{
get { return x; }
set { x = value; }
}
public double Y
{
get { return y; }
set { y = value; }
}



public double A
{
get { return A; }
set { A = value; }
}
public double B
{
get { return B; }
set { B = value; }
}
public double C
{
get { return C; }
set { C = value; }
}


public double A1
{
get { return A1; }
set { A1 = value; }
}
public double B1
{
get { return B1; }
set { B1 = value; }
}
public double C1
{
get { return C1; }
set { C1 = value; }
}
AFTER THAT I SHOUL WRITE THE LINE EQUATION AND FIND X & Y
F.moghaddampoor 19-Jan-13 13:30pm    
So is it your answer?
I mean you can once find the parametric result for x and use it in your program.
Hi,

Here are some links that have some examples on solving the linnear equations. check them:
Solving a linear equation
Linear Equations QuickStart Sample (C#)
Linear equations in c#

Thanks
 
Share this answer
 
C#
string name;
double x;
double y;

public string Name
{
    get
    {
        return name;
    }
    set
    {
        name = value;
    }
}

public double X
{
    get { return x; }
    set { x = value; }
}
public double Y
{
    get { return y; }
    set { y = value; }
}



public double A
{
    get { return A; }
    set { A = value; }
}
public double B
{
    get { return B; }
    set { B = value; }
}
public double C
{
    get { return C; }
    set { C = value; }
}


public double A1
{
    get { return A1; }
    set { A1 = value; }
}
public double B1
{
    get { return B1; }
    set { B1 = value; }
}
public double C1
{
    get { return C1; }
    set { C1 = value; }
}


AFTER THAT I SHOUL WRITE THE LINE EQUATION AND FIND X & Y.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900