日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

java shape用法_Java PShape.scale方法代码示例

發布時間:2025/3/21 java 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java shape用法_Java PShape.scale方法代码示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

import processing.core.PShape; //導入方法依賴的package包/類

public void updateAnim(){

if(pg_src_small == null){

createScene();

}

int num_x = pg_src_small.width;

int num_y = pg_src_small.height;

DwFilter.get(context).gaussblur.apply(pg_src, pg_src, pg_src_tmp, 3);

pg_src_small.beginDraw();

pg_src_small.image(pg_src, 0, 0, num_x, num_y);

pg_src_small.endDraw();

opticalflow.update(pg_src);

DwFilter.get(context).copy.apply(opticalflow.frameCurr.velocity, tex_vel_small);

flow = tex_vel_small.getFloatTextureData(flow);

DwFilter.get(context).gaussblur.apply(pg_src_small, pg_src_small, pg_src_small_tmp, 3);

pg_src_small.loadPixels();

float scene_dimx = bounds[3] - bounds[0];

float scene_dimy = bounds[4] - bounds[1];

float scene_dimz = bounds[5] - bounds[2];

float bounds_off = 100;

float dimx = (scene_dimx - bounds_off*2) / num_x;

float dimy = (scene_dimy - bounds_off*2) / num_y;

float dim = min(dimx, dimy);

float tx = -dim * num_x * 0.5f;

float ty = -dim * num_y * 0.5f;

float tz = 10;

for(int y = 0; y < num_y; y++){

for(int x = 0; x < num_x; x++){

int idx = y * num_x + x;

int rgb = pg_src_small.pixels[idx];

int r = (rgb >> 16) & 0xFF;

int g = (rgb >> 8) & 0xFF;

int b = (rgb >> 0) & 0xFF;

int flow_idx = (num_y - y - 1) * num_x + x;

float flows = 3;

float flowx = flow[flow_idx * 2 + 0] * +flows;

float flowy = flow[flow_idx * 2 + 1] * -flows;

float flow_mm = flowx*flowx + flowy*flowy;

float flow_m = (float) Math.pow(flow_mm, 0.5f);

float gray = (r + g + b) / (3f * 255f);

float px = x * dim;

float py = y * dim;

float pz = scene_dimz * gray * 0.25f + +flow_m;

pz = max(pz, 0);

PShape cube = shp_cubes[idx];

cube.resetMatrix();

cube.scale(dim);

cube.translate(tx+px, ty+py, tz+pz);

cube.setFill(rgb);

}

}

}

總結

以上是生活随笔為你收集整理的java shape用法_Java PShape.scale方法代码示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。