Make first real commit: copy of CaRMetal 4.2.8
This commit is contained in:
parent
002acfc88e
commit
c312811084
1120 changed files with 226843 additions and 1 deletions
106
rene/zirkel/structures/Complex.java
Normal file
106
rene/zirkel/structures/Complex.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package rene.zirkel.structures;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class Complex {
|
||||
private double Re,Im;
|
||||
|
||||
public Complex(double a,double b){
|
||||
Re=a;
|
||||
Im=b;
|
||||
}
|
||||
public Complex(double a){
|
||||
Re=a;
|
||||
Im=0;
|
||||
}
|
||||
|
||||
public double real(){
|
||||
return Re;
|
||||
}
|
||||
public double img(){
|
||||
return Im;
|
||||
}
|
||||
|
||||
public double module(){
|
||||
return Math.sqrt(Re*Re+Im*Im);
|
||||
}
|
||||
|
||||
public double argument(){
|
||||
double theta=Math.atan2(Im, Re);
|
||||
// if (theta<0){
|
||||
return theta;
|
||||
// } else {
|
||||
// return theta+Math.PI*2;
|
||||
// }
|
||||
}
|
||||
|
||||
public Complex sqrt() {
|
||||
double r=Math.sqrt(module());
|
||||
double theta=argument()/2;
|
||||
return new Complex(r*Math.cos(theta),r*Math.sin(theta));
|
||||
}
|
||||
|
||||
public Complex sqrt3() {
|
||||
double r=Math.pow(module(),1.0/3.0);
|
||||
double theta=argument()/3;
|
||||
return new Complex(r*Math.cos(theta),r*Math.sin(theta));
|
||||
}
|
||||
|
||||
// public Complex pow(double n){
|
||||
//
|
||||
// double r=Math.pow(module(), n);
|
||||
// double theta=argument()*n;
|
||||
// return new Complex(r*Math.cos(theta),r*Math.sin(theta));
|
||||
// }
|
||||
|
||||
public static Complex minus(Complex z1,Complex z2){
|
||||
return (new Complex(z1.Re-z2.Re,z1.Im-z2.Im));
|
||||
}
|
||||
|
||||
public static Complex plus(Complex... list){
|
||||
Complex result=new Complex(0,0);
|
||||
for (Complex elt : list) {
|
||||
result.Re+=elt.Re;
|
||||
result.Im+=elt.Im;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Complex div(Complex z1,Complex z2) {
|
||||
double md=z2.Re*z2.Re+z2.Im*z2.Im;
|
||||
return new Complex((z1.Re*z2.Re+z1.Im*z2.Im)/md,(z2.Re*z1.Im-z1.Re*z2.Im)/md);
|
||||
}
|
||||
|
||||
public static Complex div(Complex z1,double d) {
|
||||
return new Complex(z1.Re/d,z1.Im/d);
|
||||
}
|
||||
|
||||
public static Complex mult(Complex z1,double m){
|
||||
return (new Complex(z1.Re*m,z1.Im*m));
|
||||
}
|
||||
public static Complex mult(double m,Complex z1){
|
||||
return (mult(z1,m));
|
||||
}
|
||||
public static Complex mult(Complex z1,Complex z2){
|
||||
Complex result=new Complex(0,0);
|
||||
result.Re=z1.Re*z2.Re-z1.Im*z2.Im;
|
||||
result.Im=z1.Re*z2.Im+z2.Re*z1.Im;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Complex mult(final Complex... list){
|
||||
Complex result=new Complex(1,0);
|
||||
for (Complex elt : list) {
|
||||
result=mult(result,elt);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
55
rene/zirkel/structures/Coordinates.java
Normal file
55
rene/zirkel/structures/Coordinates.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
|
||||
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
|
||||
|
||||
This file is part of C.a.R. software.
|
||||
|
||||
C.a.R. is a free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
C.a.R. is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
package rene.zirkel.structures;
|
||||
|
||||
// file: Coordinates.java
|
||||
|
||||
public class Coordinates {
|
||||
public double X, Y, X1, Y1;
|
||||
public boolean join = true;
|
||||
public boolean flag = true;
|
||||
public int Color = -1, Thickness = -1;
|
||||
|
||||
public Coordinates(final double x, final double y, final boolean j) {
|
||||
X = x;
|
||||
Y = y;
|
||||
join = j;
|
||||
}
|
||||
|
||||
public Coordinates(final double x, final double y) {
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public Coordinates(final double x, final double y, final double x1,
|
||||
final double y1) {
|
||||
X = x;
|
||||
Y = y;
|
||||
X1 = x1;
|
||||
Y1 = y1;
|
||||
}
|
||||
|
||||
public Coordinates() {
|
||||
X = Double.NaN;
|
||||
Y = Double.NaN;
|
||||
}
|
||||
}
|
41
rene/zirkel/structures/Coordinates4.java
Normal file
41
rene/zirkel/structures/Coordinates4.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
|
||||
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
|
||||
|
||||
This file is part of C.a.R. software.
|
||||
|
||||
C.a.R. is a free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
C.a.R. is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
package rene.zirkel.structures;
|
||||
|
||||
// file: Coordinates.java
|
||||
public class Coordinates4 {
|
||||
|
||||
public double X, Y, X1, Y1, X2, Y2, X3, Y3;
|
||||
|
||||
public Coordinates4(final double x, final double y,
|
||||
final double x1, final double y1,
|
||||
final double x2, final double y2,
|
||||
final double x3, final double y3) {
|
||||
X=x;
|
||||
Y=y;
|
||||
X1=x1;
|
||||
Y1=y1;
|
||||
X2=x2;
|
||||
Y2=y2;
|
||||
X3=x3;
|
||||
Y3=y3;
|
||||
|
||||
}
|
||||
}
|
44
rene/zirkel/structures/CoordinatesXY.java
Normal file
44
rene/zirkel/structures/CoordinatesXY.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
|
||||
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
|
||||
|
||||
This file is part of C.a.R. software.
|
||||
|
||||
C.a.R. is a free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
C.a.R. is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
package rene.zirkel.structures;
|
||||
|
||||
// file: CoordinatesXY.java
|
||||
|
||||
public class CoordinatesXY implements Comparable<CoordinatesXY>{
|
||||
public double X=Double.NaN, Y=Double.NaN;
|
||||
|
||||
public CoordinatesXY(final double x, final double y) {
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
public CoordinatesXY(){
|
||||
|
||||
}
|
||||
|
||||
public int compareTo(CoordinatesXY o) {
|
||||
if (Double.isNaN(X)) return -1;
|
||||
if (Double.isNaN(o.X)) return 1;
|
||||
if (o.X==X) return 0;
|
||||
if (X<o.X) return -1;
|
||||
return 1;
|
||||
}
|
||||
}
|
84
rene/zirkel/structures/MagnetObj.java
Normal file
84
rene/zirkel/structures/MagnetObj.java
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
|
||||
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
|
||||
|
||||
This file is part of C.a.R. software.
|
||||
|
||||
C.a.R. is a free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
C.a.R. is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
package rene.zirkel.structures;
|
||||
|
||||
import rene.zirkel.expression.Expression;
|
||||
import rene.zirkel.objects.ConstructionObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author erichake
|
||||
*/
|
||||
public class MagnetObj {
|
||||
|
||||
private final ConstructionObject obj;
|
||||
// private int ray = -1;
|
||||
private Expression rayexp = null;
|
||||
|
||||
// public MagnetObj(ConstructionObject o, int i) {
|
||||
// obj = o;
|
||||
// ray = i;
|
||||
// rayexp=new Expression(""+i, o.getConstruction(), o);
|
||||
// }
|
||||
|
||||
public MagnetObj(final ConstructionObject o, final String s) {
|
||||
obj = o;
|
||||
rayexp = new Expression(s, o.getConstruction(), o);
|
||||
}
|
||||
|
||||
public void setSelected(final boolean b) {
|
||||
obj.setSelected(b);
|
||||
}
|
||||
|
||||
public void setStrongSelected(final boolean b) {
|
||||
obj.setStrongSelected(b);
|
||||
}
|
||||
|
||||
public boolean isInConstruction() {
|
||||
return obj.isInConstruction();
|
||||
}
|
||||
|
||||
public ConstructionObject obj() {
|
||||
return obj;
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return obj.getName();
|
||||
}
|
||||
|
||||
public String rayexp() {
|
||||
return rayexp.toString();
|
||||
}
|
||||
|
||||
public void translate() {
|
||||
rayexp.translate();
|
||||
}
|
||||
|
||||
public int ray() {
|
||||
int i = Integer.MIN_VALUE;
|
||||
try {
|
||||
i = (int) Math.round(rayexp.getValue());
|
||||
} catch (final Exception ex) {
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue