 |
|  |
 | Map making help(intersection points) |  |
   
| CT Rank: 10 |
| Field's place: def-sweep |
| Grid Name: ct¤kyle |
| GID: kyle@ct/jedi |
| CT Wild Fort Rank: na |
| Joined: 31 Mar 2006 |
| Posts: 459365373 Posts |
Location: United States
|
|
Posted: Fri Aug 18, 2006 2:57 am |
|
i made this simple C++ program to rind the intersection points of line it should work good for hex maps
i may modify it farther to do more thinks
//intecept finder
#include <fstream.h>
#include <iostream.h>
#include <iomanip.h>
#include <math.h>
int main()
{
/*----Variables----*/
double x,x1,x2,x3,x4,y,y1,y2,y3,y4,b1,b2,m1,m2;
/*----Data entry----*/
cout<<"Line 1, Point 1 X: ";
cin>>x1;
cout<<"Line 1, Point 1 Y: ";
cin>>y1;
cout<<"\nLine 1, Point 2 X: ";
cin>>x2;
cout<<"Line 1, Point 2 Y: ";
cin>>y2;
cout<<"\nLine 2, Point 1 X: ";
cin>>x3;
cout<<"Line 2, Point 1 Y: ";
cin>>y3;
cout<<"\nLine 2, Point 2 X: ";
cin>>x4;
cout<<"Line 2, Point 2 Y: ";
cin>>y4;
/*----calculations----*/
m1=((y1-y2)/(x1-x2));
m2=((y3-y4)/(x3-x4));
b1=((-1*(m1*x1))+y1);
b2=((-1*(m2*x3))+y3);
x=pow (((m1-m2)/(b1+b2)),-1);
y=m1*x+b1;
/*----Print to text file----*/
ofstream code ( "code.txt" );
code<<"<Point x=\""<<x<<"\" y=\""<<y<<"\"/>\n";
code.close();
/*----Print output----*/
cout<<"\n("<<x<<","<<y<<")\nThis code has been printed to code.txt";
return(0);
}
|
|
Last edited by kyle on Tue Dec 04, 2007 3:07 am; edited 2 times in total _________________
In theory it should work in reality who knows if it will work.
MB53: I am 26 years old how can i be a teen ?
owned: You got the heart of a teen
Gonzap: and the innocence of a little child
|
|
Ex-CTer
| CT Rank: Not a CTer |
| Field's place: |
| Grid Name: syllabear |
| GID: syllabear@ct/public |
| CT Wild Fort Rank: na |
| Joined: 14 May 2006 |
| Posts: 16F361527 Posts |
Location: UK
|
|
Posted: Fri Aug 18, 2006 7:04 am |
|
huh? why not use the circle program? or do the math (simple simple)
ur last name is slane? (  rofl  ) |
|
|
|
Will rot in Hell
| CT Rank: Not a CTer |
| Field's place: |
| Grid Name: Luzifer |
| GID: Luzifer@ct/public |
| CT Wild Fort Rank: na |
| Joined: 12 Jun 2006 |
| Posts: 3P36133 Posts |
Location: Hell
|
|
Posted: Fri Aug 18, 2006 1:28 pm |
|
As far as I know, you need a compiler, like gcc wich is freeware: http://gcc.gnu.org
This compiles the C++ Program into an .exe file so you can use it. |
|
|
|
Ex-CTer
| CT Rank: Not a CTer |
| Field's place: |
| Grid Name: |
| GID: Not working |
| CT Wild Fort Rank: |
| Joined: 27 Jul 2006 |
| Posts: 7S36280 Posts |
Location: Bakersfield, Ca
|
|
Posted: Fri Aug 18, 2006 3:22 pm |
|
Just for your information, when making my Pentagram map, this little calculation utility would have saved me a couple hours of work, at least. I did all my line intersect calculations with pen and paper and screwed up on a couple of them by accidentally missing a digit in the hundreds place on one. Line intersection is important for making accurate maps that allow grinding walls that are separated by open space (like my pentagram map, for example).
Now onto another important matter... Kyle's spelling problem...
- rind = find
- farther = further
- easyer = easier
- eaven = even
- whites = writes
- goail = goal
[18:13] [Arm] Kyle: mine i cam go as procise i want to code it just do not know how procise to make it
[18:14] * [Arm] Kyle can not spell/type tonight
One more thing... Are you going to change your handle on CT to G33K? |
|
_________________ 'Deen Foxx (Wargasm)
|
|
Ex-CTer
| CT Rank: Not a CTer |
| Field's place: |
| Grid Name: syllabear |
| GID: syllabear@ct/public |
| CT Wild Fort Rank: na |
| Joined: 14 May 2006 |
| Posts: 16F361527 Posts |
Location: UK
|
|
Posted: Sun Aug 20, 2006 4:06 am |
|
this is so mesed up C++ is so dam complicated!!!???!!! .exe?
cannot understand u its like learning french all over again - why cant they have something simple every one can understand!
so u want to make circle maps? use the circle builder tool that ed showed me. forgot the website though
and i thought i was good with computers |
|
|
   
| CT Rank: 10 |
| Field's place: def-sweep |
| Grid Name: ct¤kyle |
| GID: kyle@ct/jedi |
| CT Wild Fort Rank: na |
| Joined: 31 Mar 2006 |
| Posts: 459365373 Posts |
Location: United States
|
|
Posted: Thu Nov 16, 2006 9:18 pm |
|
And for those of you who like JAVA
here is the code
name it Intersection.java
you can run it with eclipse
import java.util.Scanner;
import java.lang.String;
public class Intersection {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter Line 1 point 1(x,y): ");
String a = in.next().replace(',',' ');
Scanner s = new Scanner(a);
double x1 =s.nextDouble();
double y1 = s.nextDouble();
System.out.println("Enter Line 1 point 2(x,y): ");
a = in.next().replace(',',' ');
s = new Scanner(a);
double x2 =s.nextDouble();
double y2 = s.nextDouble();
System.out.println("Enter Line 2 point 1(x,y): ");
a = in.next().replace(',',' ');
s = new Scanner(a);
double x3 =s.nextDouble();
double y3 = s.nextDouble();
System.out.println("Enter Line 2 point 2(x,y): ");
a = in.next().replace(',',' ');
s = new Scanner(a);
double x4 =s.nextDouble();
double y4 = s.nextDouble();
double m1 =((y1-y2)/(x1-x2));
double m2 =((y3-y4)/(x3-x4));
double b1=((-1*(m1*x1))+y1);
double b2=((-1*(m2*x3))+y3);
double x= 1/(((m1-m2)/(b1+b2)));
double y=m1*x+b1;
System.out.println("X = "+ x+"\nY = "+y);
}
} |
|
_________________
In theory it should work in reality who knows if it will work.
MB53: I am 26 years old how can i be a teen ?
owned: You got the heart of a teen
Gonzap: and the innocence of a little child
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
|
|  |