File:Haupttraegheitsachsen Quader.png

Original file(1,600 × 1,200 pixels, file size: 29 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary edit

Description
Deutsch: Hauptträgheitsachsen eines Quaders
Date
Source Own work
Author Menner

Licensing edit

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Source code edit

Requires font DejaVuSans.ttf to be placed in sub-folder Schrift. Free download here: http://dejavu-fonts.org/wiki/Download

 
#include "math.inc"
#include "strings.inc"

#include "colors.inc"

//////////////////////////////////////////////////////////////////////////////
//
// Chaotic globals
//
//////////////////////////////////////////////////////////////////////////////

#declare Vektor_Teilung = 1;
// * Vektor_Durchmesser
#declare Vektor_Durchmesser = 0.1;
// * Vektor_Schrift
#declare Vektor_Schrift = "Schrift/DejaVuSans.ttf"
#declare Winkel_Vektor_Radius = 2.5;

#declare Abstand = 12;
#declare Kameraposition = <0.2 * Abstand, 0.25 * Abstand, -0.75 * Abstand>;

//////////////////////////////////////////////////////////////////////////////
//
//
//////////////////////////////////////////////////////////////////////////////

#macro Koordinatenachsen(
    X, Y, Z, X_Farbe, Y_Farbe, Z_Farbe )
  union {
    object {
      Vektor(<0,0,0>, Y, "y", "", Y_Farbe) // povray x-Achse
    }
    
    object {
      Vektor(<0,0,0>, Z, "z", "", Z_Farbe) // povray y-Achse
    //  Vektor_Index(<0,0,0>, <0,5,0>, "L", "0")
    }
    
    object {
      Vektor(<0,0,0>, X, "x", "", X_Farbe) // povray z-Achse (und invertiert)
    }
    object {
      sphere {
        <0,0,0>, Vektor_Durchmesser
          pigment { Gray50 }
      }
    }
  }
#end // Koordinatenachsen

//////////////////////////////////////////////////////////////////////////////
//
// Makro zum Zeichnen eines Vektors als runde, pfeilartige Struktur samt
// Beschriftung.
//
//////////////////////////////////////////////////////////////////////////////
 
// Gobale Variablen
// * Vektor_Teilung
// * Kameraposition
// * Vektor_Staerke
// * Vektor_Schrift
 
#macro Vektor_Komplett(
  Ort,
  Vektor_Koordinaten,
  Beschriftung
  Index
  Beschriftung_Seite
  Farbe
// Farbe #1
// Farbe #2
  )
 
#local Laenge = vlength(Vektor_Koordinaten);
#local Laenge_Cone = Laenge - (10.*Vektor_Durchmesser);
#local Vektor_Cone = Vektor_Koordinaten * (Laenge_Cone / Laenge);
#local Kamerarichtung_Text = Kameraposition - (Ort + Vektor_Cone); // Richtung der Kamera, vom Text aus (Näherungsweise)
#local Normalvektor_Text = -1.2 * Beschriftung_Seite * vnormalize(vcross(<Kamerarichtung_Text.x, 0, Kamerarichtung_Text.z>, Vektor_Koordinaten));
#local Ortsvektor_Text = Ort + Vektor_Cone + Normalvektor_Text;
// braucht es nicht // #local Kamerarichtung_Text = Kameraposition-(Ort+Vektor_Cone+Normalvektor_Text); // Richtung der Kamera, vom Text aus
 
 
 
// Überschlagswinkel
// Normalvektor aus Kamerarichtung und Vektor in Relation zu x-z-Ebene ergibt den Winkel zur y-Achse
 
 
// Winkel zwischen Normalvektor xy-Ebene und Vektor
#local lText_xy_Angle = VAngleD(x, <Kameraposition.x,0,Kameraposition.z>);
//#local lText_xz_Angle = VAngleD(vcross(x,z), Kameraposition);
//#local lText_yz_Angle = VAngleD(vcross(y,z), Kameraposition);
 
#local lText = text {
  ttf Vektor_Schrift,
  Beschriftung, 0.025, 0
}
 
#local lIndex = text {
  ttf Vektor_Schrift,
  Index, 0.025, 0
}
 
union {
  #if (Laenge_Cone > 0.)
    union { // Pfeil
      cylinder {
        <0, 0, 0>, Vektor_Cone, Vektor_Durchmesser
      }
      cone {
        Vektor_Cone, 3.*Vektor_Durchmesser, Vektor_Koordinaten, 0.
      }
      translate Ort
    }
  #else
    #if(Laenge > Vektor_Durchmesser)
      cone {
        <0,0,0>, 3.*Vektor_Durchmesser, Vektor_Koordinaten, 0.
        translate Ort
      }
    #else
      sphere {
        <0,0,0>, Vektor_Durchmesser
        translate Ort
      }
    #end
  #end
  union { // Text
//      box { <0,0,0.1>, <2,1,1> }
    object {
      lText
      translate x*-1* max_extent(lText).x/2 // hack -> center text
      translate y*-1* max_extent(lText).y/2 // hack -> center text
    }
 
    #if ( strlen(Index) != 0 )
      object {
        lIndex
        scale 0.67
        translate y * max_extent(lText).y * (-0.5 + -0.2)
        translate x * (max_extent(lText).x/2 + 0.1)
      }
    #end // if

    //rotate <lText_xz_Angle, 0, 0>
    rotate <0, lText_xy_Angle-90, 0>
    translate Ortsvektor_Text
  }
pigment {
    color Farbe
  }
}
 
#end // Vektor_Komplett
 
//////////////////////////////////////////////////////////////////////////////
//
// Makro zum Zeichnen eines Vektors als runde, pfeilartige Struktur samt
// Beschriftung.
//
//////////////////////////////////////////////////////////////////////////////
 
#macro Vektor(
  Ort,
  Vektor_Koordinaten,
  Beschriftung,
  Index,
  Farbe
  )
Vektor_Komplett(Ort, Vektor_Koordinaten, Beschriftung, Index, 1, Farbe)
#end
 
//////////////////////////////////////////////////////////////////////////////
//
// Makro zum Zeichnen eines Vektors als runde, pfeilartige Struktur samt
// Beschriftung. Mit invertierter Beschriftungsseite.
//
//////////////////////////////////////////////////////////////////////////////
 
#macro Vektor_Invert(
  Ort,
  Vektor_Koordinaten,
  Beschriftung,
  Index,
  Farbe
  )
Vektor_Komplett(Ort, Vektor_Koordinaten, Beschriftung, Index, -1, Farbe)
#end

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// 
// MAIN
// 
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

#declare x_offset = 0;
#declare y_offset = -1;

#declare Transparenz = 1-  0.5;

// povray +I ./test.pov -geometry 1600x1200

global_settings {
  charset utf8
}
  
background {
  White
}

camera {
    orthographic
//    angle 20    
    location Kameraposition
    look_at <0, .1, 0>
}
  
light_source {
    Kameraposition
    color White * 1.5 shadowless
    parallel
    point_at<0, 0, 0> 
}

Koordinatenachsen(-2.5 * z, 3.5 * x, 5 * y,
    LimeGreen, Gray50, Blue)  // Farbe

box{
  <2, -1, 6>, <-2, 1, -6>
  pigment {
    OrangeRed transmit Transparenz
  }
}

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current08:36, 14 February 2015Thumbnail for version as of 08:36, 14 February 20151,600 × 1,200 (29 KB)Menner (talk | contribs)color
08:26, 14 February 2015Thumbnail for version as of 08:26, 14 February 20151,600 × 1,200 (28 KB)Menner (talk | contribs)update
08:25, 14 February 2015Thumbnail for version as of 08:25, 14 February 20151,600 × 1,200 (24 KB)Menner (talk | contribs)User created page with UploadWizard

There are no pages that use this file.

File usage on other wikis