Thanks!
Hi,what are the settings for the Trees?Here's an update for all the containers I've uploaded before. New tools are in bold and some of the old ones have been tweaked a bit (eg. snapped to grid, resized for a better fit,...).
Discrete Maths:
- Graphs on n points (cycles, wheels, paths, etc.)
- Famous graphs (K(3,3), Petersen, Durer, Heawood, cube, octahedron,...)
- Circulant graphs
- Petersen graphs
- Venn diagram (just three simple circles)
- Truth table
- Sequences
- Divisors
Geometry:
- Sphere
- Torus
- Fractals
- Parametric curves
Probability:
- various discrete distributions (graphs and tables)
- Bell curve (graph)
- Chi squared curve (graph)
Statistics:
- Sample Statistics
- Pie Chart
- Bar Chart
- Linear Regression
- Student Table
- Chi-squared Table
Misc:
- Parabola
- Square Root Symbol
- Checkerboard
- Trees
- Buffon Needle Simulator
- Vector fields
- Euclidean Algorithm
Some tools would really benefit from string input, though, or at least integers/floats entered via numberical keyboard. For example, the script that lists all divisors of a given integer. It's a bit annoying to have to use the slider to find a particular integer between 1 and 1000. Initially, I wanted it to go up to 10000 or more since it doesn't take that much longer to run, but selecting the desired integer was too time consuming.
Similarly, linear regression uses precisely 5 data points right now. If at some point it becomes possible to input string parameters or at least use more than 10 parameters I'll tweak the tool to make it work for n points. I suppose I could borrow Tamasaka's method to write the data into the keyword file but I'd rather wait for more suitable input methods to become available.
Oh, and I've been experimenting with rainbow colors in some of the tools (like in Vector Fields, where the color of the vector depends on the angle). It makes for nice looking graphics but it slows the tools down even more. I'm quite certain that the tools are much slower on my Note 12.2 compared to 10.1. I don't have the 10.1 with me at the moment, so I cannot verify. Let me know if you have runtime problems with any of the tools although there's not much I can do to make them work. Sometimes it fails once and then works on the next try. Parametric curves seem to be particulary sensitive to the number of plotpoints, and Fractals to the level of recursion.
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
step = width / 150 + scale * width / 25;
/*Übergabe des Anfgnag und Endpunkts in eine Variable*/
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
/*Einrasten der Punkte in dem eingestlltem Rastermaß*/
x1g = (step *1/2) + Math.floor((x1 - (step *1/2)) / step + 0.5) * step;
y1g = (step* 1/2) + Math.floor((y1 - (step *1/2)) / step + 0.5) * step;
x2g = (step *1/2) + Math.floor((x2 - (step *1/2)) / step + 0.5) * step;
y2g = (step *1/2) + Math.floor((y2 - (step *1/2)) / step + 0.5) * step;
/*berechnen des Abstands zwischen Punkt 1 und 2*/
dx = x2g -x1g;
dy = y2g -y1g;
dxabs=Math.abs(dx);
dyabs=Math.abs(dy);
if(dxabs>dyabs)
{
/* ------------------------------------------------------------------------------ rechts Quadrant 1+4 ------------------------------------------------------------------------------ */
if(dx>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g+1*step;
anp01y=y1g;
anp10x= x1g+3*step;
anp10y=y1g;
anp11x= x1g+4*step;
anp11y=y1g;
/*berechnen der Y-Koordinaten von den oberen und unteren Ecken des Widerstadskörpers*/
r1x= x1g+1*step;
r1y= y1g+0.4*step;
r2x= x1g+3*step;
r2y= y1g-0.4*step;
}
/* ------------------------------------------------------------------------------ links Quadrant 2+3 ------------------------------------------------------------------------------ */
if(dx<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g-1*step;
anp01y=y1g;
anp10x= x1g-3*step;
anp10y=y1g;
anp11x= x1g-4*step;
anp11y=y1g;
/*berechnen der Y-Koordinaten von den oberen und unteren Ecken des Widerstadskörpers*/
r1x= x1g-1*step;
r1y= y1g+0.4*step;
r2x= x1g-3*step;
r2y= y1g-0.4*step;
}
}
if(dxabs<dyabs)
{
/* ------------------------------------------------------------------------------ unten Quadrant 3+4 ------------------------------------------------------------------------------ */
if(dy>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g+1*step;
anp10x= x1g;
anp10y=y1g+3*step;
anp11x= x1g;
anp11y=y1g+4*step;
/*berechnen der Y-Koordinaten von den oberen und unteren Ecken des Widerstadskörpers*/
r1x= x1g+0.4*step;
r1y= y1g+1*step;
r2x= x1g-0.4*step;
r2y= y1g+3*step;
}
/* ------------------------------------------------------------------------------ oben Quadrant 1+2 ------------------------------------------------------------------------------ */
if(dy<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g-1*step;
anp10x= x1g;
anp10y=y1g-3*step;
anp11x= x1g;
anp11y=y1g-4*step;
/*berechnen der Y-Koordinaten von den oberen und unteren Ecken des Widerstadskörpers*/
r1x= x1g+0.4*step;
r1y= y1g-1*step;
r2x= x1g-0.4*step;
r2y= y1g-3*step;
}
}
/*herrausfinden der zwei Punkte aus denen das Clippingfenster gezeichent wird*/
xmin = Math.min(anp00x, anp01x, anp10x, anp11x, r1x, r2x) ;
ymin = Math.min( anp00y, anp01y, anp10y, anp11y, r1y, r2y );
xmax = Math.max( anp00x, anp01x, anp10x, anp11x, r1x, r2x );
ymax = Math.max( anp00y, anp01y, anp10y, anp11y, r1y, r2y ) ;
LN.setClip(xmin, ymin, xmax, ymax);
/*Zeichnen der Linien für die Anschlüsse*/
LN.drawLine(anp00x, anp00y, anp01x, anp01y);
LN.drawLine(anp10x, anp10y, anp11x, anp11y);
/*Zeichnen des Rechtecks für den Widerstandskörper*/
LN.drawRect(r1x, r1y, r2x, r2y);
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
step = width / 150 + scale * width / 25;
/*Übergabe des Anfgnag und Endpunkts in eine Variable*/
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
/*Einrasten der Punkte in dem eingestlltem Rastermaß*/
x1g = (step *1/2) + Math.floor((x1 - (step *1/2)) / step + 0.5) * step;
y1g = (step* 1/2) + Math.floor((y1 - (step *1/2)) / step + 0.5) * step;
x2g = (step *1/2) + Math.floor((x2 - (step *1/2)) / step + 0.5) * step;
y2g = (step *1/2) + Math.floor((y2 - (step *1/2)) / step + 0.5) * step;
/*berechnen des Abstands zwischen Punkt 1 und 2*/
dx = x2g -x1g;
dy = y2g -y1g;
dxabs=Math.abs(dx);
dyabs=Math.abs(dy);
if(dxabs>dyabs)
{
/* ------------------------------------------------------------------------------ rechts Quadrant 1+4 ------------------------------------------------------------------------------ */
if(dx>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g+1.75*step;
anp01y=y1g;
anp10x= x1g+2.25*step;
anp10y=y1g;
anp11x= x1g+4*step;
anp11y=y1g;
/*berechnen der Koordinaten fuer die Kondensatorplatten*/
r00x= x1g+1.75*step;
r00y= y1g+1*step;
r01x= x1g+1.75*step;
r01y= y1g-1*step;
r10x= x1g+2.25*step;
r10y= y1g+1*step;
r11x= x1g+2.25*step;
r11y= y1g-1*step;
}
/* ------------------------------------------------------------------------------ links Quadrant 2+3 ------------------------------------------------------------------------------ */
if(dx<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g-1.75*step;
anp01y=y1g;
anp10x= x1g-2.25*step;
anp10y=y1g;
anp11x= x1g-4*step;
anp11y=y1g;
/*berechnen der Koordinaten fuer die Kondensatorplatten*/
r00x= x1g-1.75*step;
r00y= y1g+1*step;
r01x= x1g-1.75*step;
r01y= y1g-1*step;
r10x= x1g-2.25*step;
r10y= y1g+1*step;
r11x= x1g-2.25*step;
r11y= y1g-1*step;
}
}
if(dxabs<dyabs)
{
/* ------------------------------------------------------------------------------ unten Quadrant 3+4 ------------------------------------------------------------------------------ */
if(dy>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g+1.75*step;
anp10x= x1g;
anp10y=y1g+2.25*step;
anp11x= x1g;
anp11y=y1g+4*step;
/*berechnen der Koordinaten fuer die Kondensatorplatten*/
r00x= x1g+1*step;
r00y= y1g+1.75*step;
r01x= x1g-1*step;
r01y= y1g+1.75*step;
r10x= x1g+1*step;
r10y= y1g+2.25*step;
r11x= x1g-1*step;
r11y= y1g+2.25*step;
}
/* ------------------------------------------------------------------------------ oben Quadrant 1+2 ------------------------------------------------------------------------------ */
if(dy<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g-1.75*step;
anp10x= x1g;
anp10y=y1g-2.25*step;
anp11x= x1g;
anp11y=y1g-4*step;
/*berechnen der Koordinaten fuer die Kondensatorplatten*/
r00x= x1g+1*step;
r00y= y1g-1.75*step;
r01x= x1g-1*step;
r01y= y1g-1.75*step;
r10x= x1g-1*step;
r10y= y1g-2.25*step;
r11x= x1g+1*step;
r11y= y1g-2.25*step;
}
}
/*herrausfinden der zwei Punkte aus denen das Clippingfenster gezeichent wird*/
xmin = Math.min( anp00x, anp01x, anp10x, anp11x, r00x, r01x, r10x, r11x) ;
ymin = Math.min( anp00y, anp01y, anp10y, anp11y, r00y, r01y, r10y, r11y );
xmax = Math.max( anp00x, anp01x, anp10x, anp11x, r00x, r01x, r10x, r11x );
ymax = Math.max( anp00y, anp01y, anp10y, anp11y, r00y, r01y, r10y, r11y );
LN.setClip(xmin, ymin, xmax, ymax);
/*Zeichnen der Linien für die Anschlüsse*/
LN.drawLine(anp00x, anp00y, anp01x, anp01y);
LN.drawLine(anp10x, anp10y, anp11x, anp11y);
/*Zeichnen der Kondensator Platten*/
LN.drawLine(r00x, r00y, r01x, r01y);
LN.drawLine(r10x, r10y, r11x, r11y);
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
step = width / 150 + scale * width / 25;
/*Übergabe des Anfgnag und Endpunkts in eine Variable*/
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
/*Einrasten der Punkte in dem eingestlltem Rastermaß*/
x1g = (step *1/2) + Math.floor((x1 - (step *1/2)) / step + 0.5) * step;
y1g = (step* 1/2) + Math.floor((y1 - (step *1/2)) / step + 0.5) * step;
x2g = (step *1/2) + Math.floor((x2 - (step *1/2)) / step + 0.5) * step;
y2g = (step *1/2) + Math.floor((y2 - (step *1/2)) / step + 0.5) * step;
/*berechnen des Abstands zwischen Punkt 1 und 2*/
dx = x2g -x1g;
dy = y2g -y1g;
dxabs=Math.abs(dx);
dyabs=Math.abs(dy);
if(dxabs>dyabs)
{
/* ------------------------------------------------------------------------------ rechts Quadrant 1+4 ------------------------------------------------------------------------------ */
if(dx>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g+4*step;
anp01y=y1g;
/*berechnen der Koordinaten für den Kreis Mittelpunkt*/
r1x= x1g+2*step;
r1y= y1g;
}
/* ------------------------------------------------------------------------------ links Quadrant 2+3 ------------------------------------------------------------------------------ */
if(dx<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g-4*step;
anp01y=y1g;
/*berechnen der Koordinaten für den Kreis Mittelpunkt*/
r1x= x1g-2*step;
r1y= y1g;
}
}
if(dxabs<dyabs)
{
/* ------------------------------------------------------------------------------ unten Quadrant 3+4 ------------------------------------------------------------------------------ */
if(dy>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g+4*step;
/*berechnen der Koordinaten für den Kreis Mittelpunkt*/
r1x= x1g;
r1y= y1g+2*step;
}
/* ------------------------------------------------------------------------------ oben Quadrant 1+2 ------------------------------------------------------------------------------ */
if(dy<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g-4*step;
/*berechnen der Koordinaten für den Kreis Mittelpunkt*/
r1x= x1g;
r1y= y1g-2*step;
}
}
/*herrausfinden der zwei Punkte aus denen das Clippingfenster gezeichent wird*/
xmin = Math.min(anp00x, anp01x, r1x-2*step) ;
ymin = Math.min( anp00y, anp01y, r1y-2*step);
xmax = Math.max( anp00x, anp01x, r1x+2*step);
ymax = Math.max( anp00y, anp01y, r1y+2*step) ;
LN.setClip(xmin, ymin, xmax, ymax);
/*Zeichnen der Linien für die Anschlüsse*/
LN.drawLine(anp00x, anp00y, anp01x, anp01y);
/*Zeichnen des Kreis für die Spannungsquelle*/
LN.drawCircle (r1x, r1y, 1*step);
/*Einstellungen*/
halbebreite=0.7; /* die halbe Breite im Längsquerschnitt*/
laenge_pin=1.5;
laenge_gesamt=4;
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
step = width / 150 + scale * width / 25;
/*Übergabe des Anfgnag und Endpunkts in eine Variable*/
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
/*Einrasten der Punkte in dem eingestlltem Rastermaß*/
x1g = (step *1/2) + Math.floor((x1 - (step *1/2)) / step + 0.5) * step;
y1g = (step* 1/2) + Math.floor((y1 - (step *1/2)) / step + 0.5) * step;
x2g = (step *1/2) + Math.floor((x2 - (step *1/2)) / step + 0.5) * step;
y2g = (step *1/2) + Math.floor((y2 - (step *1/2)) / step + 0.5) * step;
/*berechnen des Abstands zwischen Punkt 1 und 2*/
dx = x2g -x1g;
dy = y2g -y1g;
dxabs=Math.abs(dx);
dyabs=Math.abs(dy);
if(dxabs>dyabs)
{
/* ------------------------------------------------------------------------------ rechts Quadrant 1+4 ------------------------------------------------------------------------------ */
if(dx>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g+ laenge_pin *step;
anp01y=y1g;
anp10x= x1g+2.5*step;
anp10y=y1g;
anp11x= x1g+4*step;
anp11y=y1g;
/*berechnen der Koordinaten fuer die Kondensatorplatten*/
tr00x= x1g+ laenge_pin *step;
tr00y= y1g+ halbebreite *step;
tr01x= x1g+ laenge_pin *step;
tr01y= y1g- halbebreite *step;
tr02x=anp10x;
tr02y=anp10y;
r00x= anp10x;
r00y= anp10y + halbebreite *step;
r01x= anp10x;
r01y= anp10y - halbebreite *step;
}
/* ------------------------------------------------------------------------------ links Quadrant 2+3 ------------------------------------------------------------------------------ */
if(dx<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g- laenge_pin *step;
anp01y=y1g;
anp10x= x1g-2.5*step;
anp10y=y1g;
anp11x= x1g-4*step;
anp11y=y1g;
/*berechnen der Koordinaten fuer die Kondensatorplatten*/
tr00x= x1g- laenge_pin *step;
tr00y= y1g+ halbebreite *step;
tr01x= x1g- laenge_pin *step;
tr01y= y1g- halbebreite *step;
tr02x=anp10x;
tr02y=anp10y;
r00x= anp10x;
r00y= anp10y + halbebreite *step;
r01x= anp10x;
r01y= anp10y - halbebreite *step;
}
}
if(dxabs<dyabs)
{
/* ------------------------------------------------------------------------------ unten Quadrant 3+4 ------------------------------------------------------------------------------ */
if(dy>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g+ laenge_pin *step;
anp10x= x1g;
anp10y=y1g+2.5*step;
anp11x= x1g;
anp11y=y1g+4*step;
/*berechnen der Koordinaten fuer die Kondensatorplatten*/
tr00x= x1g+ halbebreite *step;
tr00y= y1g+ laenge_pin *step;
tr01x= x1g- halbebreite *step;
tr01y= y1g+ laenge_pin *step;
tr02x=anp10x;
tr02y=anp10y;
r00x= anp10x+ halbebreite *step;
r00y= anp10y;
r01x= anp10x- halbebreite *step;
r01y= anp10y;
}
/* ------------------------------------------------------------------------------ oben Quadrant 1+2 ------------------------------------------------------------------------------ */
if(dy<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g- laenge_pin *step;
anp10x= x1g;
anp10y=y1g-2.5*step;
anp11x= x1g;
anp11y=y1g-4*step;
/*berechnen der Koordinaten fuer die Kondensatorplatten*/
tr00x= x1g+ halbebreite *step;
tr00y= y1g- laenge_pin *step;
tr01x= x1g- halbebreite *step;
tr01y= y1g- laenge_pin *step;
tr02x=anp10x;
tr02y=anp10y;
r00x= anp10x+ halbebreite *step;
r00y= anp10y;
r01x= anp10x- halbebreite *step;
r01y= anp10y;
}
}
/*herrausfinden der zwei Punkte aus denen das Clippingfenster gezeichent wird */
xmin = Math.min( anp00x, anp01x, anp10x, anp11x, r00x, r01x, tr00x, tr01x, tr02x) ;
ymin = Math.min( anp00y, anp01y, anp10y, anp11y, r00y, r01y, tr00y, tr01y, tr02y );
xmax = Math.max( anp00x, anp01x, anp10x, anp11x, r00x, r01x, tr00x, tr01x, tr02x );
ymax = Math.max( anp00y, anp01y, anp10y, anp11y, r00y, r01y, tr00y, tr01y, tr02y );
LN.setClip(xmin, ymin, xmax, ymax);
/*Zeichnen der Linien für die Anschlüsse */
LN.drawLine(anp00x, anp00y, anp01x, anp01y);
LN.drawLine(anp10x, anp10y, anp11x, anp11y);
/*Zeichnen der Kondensator Platten*/
LN.drawLine(r00x, r00y, r01x, r01y);
LN.drawTriangle( tr00x, tr00y, tr01x, tr01y, tr02x, tr02y );
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
step = width / 150 + scale * width / 25;
/*Übergabe des Anfgnag und Endpunkts in eine Variable*/
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
/*Einrasten der Punkte in dem eingestlltem Rastermaß*/
x1g = (step *1/2) + Math.floor((x1 - (step *1/2)) / step + 0.5) * step;
y1g = (step* 1/2) + Math.floor((y1 - (step *1/2)) / step + 0.5) * step;
x2g = (step *1/2) + Math.floor((x2 - (step *1/2)) / step + 0.5) * step;
y2g = (step *1/2) + Math.floor((y2 - (step *1/2)) / step + 0.5) * step;
/*berechnen des Abstands zwischen Punkt 1 und 2*/
dx = x2g -x1g;
dy = y2g -y1g;
dxabs=Math.abs(dx);
dyabs=Math.abs(dy);
if(dxabs>dyabs)
{
/* ------------------------------------------------------------------------------ rechts Quadrant 1+4 ------------------------------------------------------------------------------ */
if(dx>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g+1*step;
anp01y=y1g;
anp10x= x1g+3*step;
anp10y=y1g;
anp11x= x1g+4*step;
anp11y=y1g;
/*berechnen der Y-Koordinaten von den oberen und unteren Ecken des Widerstadskörpers*/
r1x= x1g+1*step;
r1y= y1g+0.4*step;
r2x= x1g+3*step;
r2y= y1g-0.4*step;
}
/* ------------------------------------------------------------------------------ links Quadrant 2+3 ------------------------------------------------------------------------------ */
if(dx<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g-1*step;
anp01y=y1g;
anp10x= x1g-3*step;
anp10y=y1g;
anp11x= x1g-4*step;
anp11y=y1g;
/*berechnen der Y-Koordinaten von den oberen und unteren Ecken des Widerstadskörpers*/
r1x= x1g-1*step;
r1y= y1g+0.4*step;
r2x= x1g-3*step;
r2y= y1g-0.4*step;
}
}
if(dxabs<dyabs)
{
/* ------------------------------------------------------------------------------ oben Quadrant 1+2 ------------------------------------------------------------------------------ */
if(dy>0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g+1*step;
anp10x= x1g;
anp10y=y1g+3*step;
anp11x= x1g;
anp11y=y1g+4*step;
/*berechnen der Y-Koordinaten von den oberen und unteren Ecken des Widerstadskörpers*/
r1x= x1g+0.4*step;
r1y= y1g+1*step;
r2x= x1g-0.4*step;
r2y= y1g+3*step;
}
/* ------------------------------------------------------------------------------ unten Quadrant 3+4 ------------------------------------------------------------------------------ */
if(dy<0)
{
/*berechnen der Anfang- und Endpunkte der Anschlusspins des Widerstands*/
anp00x=x1g;
anp00y=y1g;
anp01x= x1g;
anp01y=y1g-1*step;
anp10x= x1g;
anp10y=y1g-3*step;
anp11x= x1g;
anp11y=y1g-4*step;
/*berechnen der Y-Koordinaten von den oberen und unteren Ecken des Widerstadskörpers*/
r1x= x1g+0.4*step;
r1y= y1g-1*step;
r2x= x1g-0.4*step;
r2y= y1g-3*step;
}
}
/*herrausfinden der zwei Punkte aus denen das Clippingfenster gezeichent wird*/
xmin = Math.min(anp00x, anp01x, anp10x, anp11x, r1x, r2x) ;
ymin = Math.min( anp00y, anp01y, anp10y, anp11y, r1y, r2y );
xmax = Math.max( anp00x, anp01x, anp10x, anp11x, r1x, r2x );
ymax = Math.max( anp00y, anp01y, anp10y, anp11y, r1y, r2y ) ;
LN.setClip(xmin, ymin, xmax, ymax);
/*Zeichnen der Linien für die Anschlüsse*/
LN.drawLine(anp00x, anp00y, anp01x, anp01y);
LN.drawLine(anp10x, anp10y, anp11x, anp11y);
/*Zeichnen des Rechtecks für den Widerstandskörper*/
LN.drawFilledRect(r1x, r1y, r2x, r2y);
width = LN.getWidth();
height = LN.getHeight();
scale = LN.getScale();
k=2;
/*k = LN.getParameter(1);*/
step = width / 150 + scale * width / 25;
step = step /k;
x1 = LN.getX1();
y1 = LN.getY1();
/*Einrasten der Punkte in dem eingestlltem Rastermaß*/
x1g = (step *k/2) + Math.floor((x1 - (step *k/2)) / step + 0.5) * step;
y1g = (step* k/2) + Math.floor((y1 - (step *k/2)) / step + 0.5) * step;
rg = step/3;
/*herrausfinden der zwei Punkte aus denen das Clippingfenster gezeichent wird*/
xmin = x1g - rg;
ymin = y1g - rg;
xmax = x1g + rg;
ymax = y1g + rg;
LN.setClip(xmin, ymin, xmax, ymax);
LN. drawFilledCircle (x1g, y1g, rg);
@Tintinnuntius: I very much appreciate your posts. Would it be possible to include the ZIP file into the posts that LectureNotes creates upon sharing the custom drawing tool? This would make usage much easier, one would only need to import the ZIP file.
width = LN.getWidth();
scale = LN.getScale ();
step = width / 150 + scale * width / 25;
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2() - 10;
y2 = LN.getY2() - 10;
x1g = Math.floor((x1 - (step / 2)) / step + 0.5) * step;
y1g = Math.floor((y1 - (step / 2)) / step + 0.5) * step;
x2g = Math.floor((x2 - (step / 2)) / step + 0.5) * step;
y2g = Math.floor((y2 - (step / 2)) / step + 0.5) * step;
tall = scale * 14;
wide = tall * 2;
LN.setClip(x2g - tall, y2g- tall, x2g + wide, y2g + tall);
LN.drawLine(x2g, y2g, x2g - tall, y2g - tall);
LN.drawLine(x2g, y2g, x2g - tall, y2g + tall);
LN.drawLine(x2g - tall, y2g -tall, x2g + wide, y2g);
LN.drawLine(x2g - tall, y2g + tall, x2g + wide, y2g);
width = LN.getWidth();
scale = LN.getScale ();
step = width / 150 + scale * width / 25;
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2() - 10;
y2 = LN.getY2() - 10;
x1g = Math.floor((x1 - (step / 2)) / step + 0.5) * step;
y1g = Math.floor((y1 - (step / 2)) / step + 0.5) * step;
x2g = Math.floor((x2 - (step / 2)) / step + 0.5) * step;
y2g = Math.floor((y2 - (step / 2)) / step + 0.5) * step;
tall = scale * 12;
wide = tall * 2;
LN.setClip( x2g - wide/2, y2g - wide/2, x2g+ wide/2, y2g + wide/2 );
LN.drawRect(x2g - wide/2, y2g - wide/2, x2g+ wide/2, y2g + wide/2);
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
pi = 3.14159;
r = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
xmin = x1 - r;
ymin = y1 - r;
xmax = x1 + r;
ymax = y1 + r;
scaler = r;
c1 = scaler * (Math.sqrt (5)-1) / 4;
c2 = scaler * (Math.sqrt (5)+1) / 4;
s1 = scaler * Math.sqrt (10 + 2 * Math.sqrt (5)) / 4;
s2 = scaler * Math.sqrt (10 - 2 * Math.sqrt (5)) / 4;
LN.setClip(xmin, ymin, xmax, ymax);
LN.drawLine(x1 + scaler, y1, x1 - c2, y1 + s2);
LN.drawLine(x1 + scaler, y1, x1 - c2, y1 - s2);
LN.drawLine(x1 - c2, y1 + s2, x1 + c1, y1 - s1);
LN.drawLine(x1 - c2, y1 - s2, x1 + c1, y1 + s1);
LN.drawLine(x1 + c1, y1 + s1, x1 + c1, y1 - s1);
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
r = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
xmin = x1 - r;
ymin = y1 - r;
xmax = x1 + r;
ymax = y1 + r;
eye = 1+ r/ 12;
LN.setClip(xmin, ymin, xmax, ymax);
LN.drawOval(x1, y1, r, r);
LN.drawFilledOval(x1 + r/ 3, y1 - r/3, eye, eye);
LN.drawFilledOval(x1 - r/ 3, y1 - r/3, eye, eye);
LN.drawArc(x1, y1, r / 1.8, 0, 3.14);
/* cylinder 1.0 */
x1 = LN.getX1();
y1 = LN.getY1();
x2 = LN.getX2();
y2 = LN.getY2();
xmin = Math.min(x1, x2);
ymin = Math.min(y1, y2);
xmax = Math.max(x1, x2);
ymax = Math.max(y1, y2);
xbar = (x1+x2)/2;
r1 = Math.abs(x2-xbar);
r2 = Math.abs(0.2*(y2-y1));
LN.setClip(xmin, ymin - r1, xmax, ymax+r1);
LN.drawLine(x1, y1, x1, y2);
LN.drawLine(x2, y1, x2, y2);
LN.drawArc(xbar, ymin, r1,r2, 6.28, 6.28);
LN.drawArc(xbar, ymax, r1,r2, 0, 3.14);