Examples of Rect


Examples of BasicDataType.Rect

//      map.propagateEmpty((byte)0, (byte)y);
//    }
//    for(int x=1; x < 3; x++){
//      map.propagateEmpty((byte)x, (byte)0);
//    }
    Rect bound = new Rect(5, 6, 6,5);
    Search search = new Search(map);   
    for(int i = 0; i < 5 ; i++) {
      currentPos = search.getNext(currentPos, map, bound);
      if (currentPos == null) {
        bound.setRect(0, 9, 9, 0);
        currentPos = new Position(new Vector(5,5), 3);
        for(int j = 0; j < 5 ; j++) {
          currentPos = search.getNext(currentPos, map, bound);
          map.propagateEmpty((byte)currentPos.pos.x,(byte)currentPos.pos.y);
          map.showMap();
View Full Code Here

Examples of GShape.Core.Objects.Primitives.rect

public class Ex004_Skyscraper extends PApplet {

  public void setup () {
   
    GShape.begin(this, "Top0", new rect (0, 0, 20, 20, 0) ); // Must be called, otherwise it will not work
       
   
    // Building
    int i = 0;
    while (true) {
View Full Code Here

Examples of GShape.Core.Objects.Primitives.rect

public class Ex008_EmbeddParent extends PApplet{
 
  public void setup () {
       
    // Initialize
    rect iniGeometry = new rect (10, 10, 60, 80, 0);
    GShape.begin(this, "Rect", iniGeometry); // Must be called, otherwise it will not work
    GShape.showCoordinates();
   
   
    // Embedd externel object
View Full Code Here

Examples of GShape.Core.Objects.Primitives.rect

public class Ex005_SimpleSimulation extends PApplet{
 
  public void setup () {
   
    GShape.begin(this, "Ground", new rect (10, 10, 100, 200, 0)); // Must be called, otherwise it will not work
    GShape.showCoordinates();
   
   
    // Attributes
    GShape.setAttribute ("height", 100);
View Full Code Here

Examples of GShape.Core.Objects.Primitives.rect

public class Ex002_AlignVolumes  extends PApplet{
 
  public void setup () {

      GShape.begin(this, "Ground", new rect (10, 10, 100, 200, 0)); // Must be called, otherwise it will not work
       
     
      // Envirement
      GShape.SplitY ("Ground", "~40m:Sectors");
      GShape.SplitY ("Sectors", "~10m ; ~30m:Lots");
View Full Code Here

Examples of GShape.Core.Objects.Primitives.rect

public class Ex008_EmbeddChild extends PApplet{
 
  public void setup () {
   
    // Initialize
    GShape.begin(this, "Ground", new rect (10, 10, 34, 50, 0) ); // Must be called, otherwise it will not work
    GShape.showCoordinates();

   
    // Attributes
    Random rand = new Random();
View Full Code Here

Examples of GShape.Core.Objects.Primitives.rect

public class Ex003_SimpleVolumeDraw extends PApplet{
 
  public void setup () {

    GShape.begin(this, "Ground", new rect (10, 10, 100, 200, 0)); // Must be called, otherwise it will not work
    GShape.showCoordinates();

  }
View Full Code Here

Examples of GShape.Core.Objects.Primitives.rect

    for (iGObject src : source) {
     
      // Get base geometrie
      Object base = src.GetPrimitive(rect.class);
      if (base != null) {
        rect oRect = (rect) base;


        // Looping new Objects:
        for (GExpressionItem item : exp.Items) { // Bsp: "5m ; Xm:Perimeter ; 5m"
         
          if (directionX) { // Split X
           
            float length = oRect.width;
            // absolut, x or percentage
            if (item.isNumber && (item.isAbsolut || item.isX || item.isPercentage)) // Bsp: 5m
              new PRect (core, item.getString(), new rect (oRect.p1.x + item.getOffset(length, exp),  oRect.p1.y, oRect.p1.x + item.getOffset(length, exp) + item.getNumber(length, 0), oRect.p2.y, oRect.z), src);
            // Tilde
            if (item.isTilde) {
              for (int ii=0;ii<item.getCount(length);ii++) {
                             
                float num = item.getNumber(length, 0);
                new PRect (core, item.getString()new rect (oRect.p1.x,  oRect.p1.y + item.getOffset(length, exp) + ii * num, oRect.p2.x, oRect.p1.y + item.getOffset(length, exp) + (ii + 1) * num, oRect.z), src);

              }
            }
           
          } else { // Split Y
           
            float length = oRect.depth;
            if (item.isNumber && item.isAbsolut) // Bsp: 5m
              new PRect (core, item.getString(), new rect (oRect.p1.x,  oRect.p1.y + item.getOffset(length, exp), oRect.p2.x, oRect.p1.y + item.getOffset(length, exp) + item.getNumber(0, 0), oRect.z), src);         
            // X
            if (item.isNumber && item.isX) // Bsp: Xm
              new PRect (core, item.getString()new rect (oRect.p1.x,  oRect.p1.y + item.getOffset(length, exp), oRect.p2.x, oRect.p1.y + item.getOffset(length, exp) + item.getNumber(length, 0), oRect.z), src);
            // Tilde
            if (item.isTilde) {
              for (int ii=0;ii<item.getCount(length);ii++) {
                             
                float num = item.getNumber(length, 0);
                new PRect (core, item.getString()new rect (oRect.p1.x,  oRect.p1.y + item.getOffset(length, exp) + ii * num, oRect.p2.x, oRect.p1.y + item.getOffset(length, exp) + (ii + 1) * num, oRect.z), src);

              }
            }
         
          }
View Full Code Here

Examples of GShape.Core.Objects.Primitives.rect

  public void PerformRule(GCore core, iGObject src, GExpression exp, int tmpWhichDirection) throws Exception {

      // Get base geometrie
      Object base = src.GetPrimitive(rect.class);
      if (base != null) {
        rect oRect = (rect) base;

       
        // Only one Item!!
        if (exp.Items.size() == 1 && exp.Items.get(0).isNumber) {
         
          // Item
          GExpressionItem item = exp.Items.get(0); // Bsp: "100m:70m:Lots:30%"
         
         
          // Random value 0 or 1 (width or depth)
          java.util.Random rnd = new java.util.Random ();
          int whichDirection = rnd.nextInt(2); // 0 to 1
          if (tmpWhichDirection != -1)
            whichDirection = tmpWhichDirection;
          int mirror = rnd.nextInt(2); // 0 to 1

         
          // Which direction?
          float factorX = 1;
          float factorY = 1;
          if (whichDirection == 0) // width
            factorX = Math.abs(mirror - (item.Parts.get(3).Number / 100)); // bsp 30% direction X
          else  // depth
            factorY = Math.abs(mirror - (item.Parts.get(3).Number / 100)); // bsp 30% direction Y
         

          // Create 2 new rects (only geometry first)
          float x = (oRect.p2.x - oRect.p1.x) * factorX + oRect.p1.x;
          float y = (oRect.p2.y - oRect.p1.y) * factorY + oRect.p1.y;
          float x2 = (oRect.p2.x - oRect.p1.x) * factorX + oRect.p1.x;
          float y2 = (oRect.p2.y - oRect.p1.y) * factorY + oRect.p1.y;
          if (whichDirection == 1) x2 = oRect.p1.x; else y2 = oRect.p1.y;
          rect rec1 = new rect (oRect.p1.x, oRect.p1.y, x, y, oRect.z);
          rect rec2 = new rect (x2, y2, oRect.p2.x, oRect.p2.y, oRect.z);
         
         
          // Create object and call this class recursive
          //  - if min with and min height not to small
          //  - no recursive function in else case if tmpWhichDirection != -1
View Full Code Here

Examples of android.graphics.Rect

                    ApplyMaskRgb am = new ApplyMaskRgb();
                    RgbImage rgb = am.Push((RgbImage)rs.Front(), imMask);
                    g.drawARGB(0, 0, 255, 0); // green
                    g.drawBitmap(
                            RgbImageAndroid.toBitmap(rgb),
                            new Rect(0, 0, rgb.getWidth(), rgb.getHeight()),
                            new Rect(
                                (g.getBitmapWidth() - rgb.getWidth())/2,
                                (g.getBitmapHeight() - rgb.getHeight())/2,
                                rgb.getWidth(),
                                rgb.getHeight()),
                            new Paint());
                } else {
                    RgbImage rgb = (RgbImage) rs.Front();
                    g.drawARGB(0, 255, 0, 0); // red
                    g.drawBitmap(
                            RgbImageAndroid.toBitmap(rgb),
                            new Rect(0, 0, rgb.getWidth(), rgb.getHeight()),
                            new Rect(
                                (g.getBitmapWidth() - rgb.getWidth())/2,
                                (g.getBitmapHeight() - rgb.getHeight())/2,
                                rgb.getWidth(),
                                rgb.getHeight()),
                            new Paint());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.