• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Point4f类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.vecmath.Point4f的典型用法代码示例。如果您正苦于以下问题:Java Point4f类的具体用法?Java Point4f怎么用?Java Point4f使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Point4f类属于javax.vecmath包,在下文中一共展示了Point4f类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPlane

import javax.vecmath.Point4f; //导入依赖的package包/类
static Point4f getPlane(String str) {
  if (str.equalsIgnoreCase("xy"))
    return new Point4f(0, 0, 1, 0);
  if (str.equalsIgnoreCase("xz"))
    return new Point4f(0, 1, 0, 0);
  if (str.equalsIgnoreCase("yz"))
    return new Point4f(1, 0, 0, 0);
  if (str.indexOf("x=") == 0) {
    return new Point4f(1, 0, 0, -Parser.parseFloat(str.substring(2)));
  }
  if (str.indexOf("y=") == 0) {
    return new Point4f(0, 1, 0, -Parser.parseFloat(str.substring(2)));
  }
  if (str.indexOf("z=") == 0) {
    return new Point4f(0, 0, 1, -Parser.parseFloat(str.substring(2)));
  }
  if (str.indexOf("{") == 0) {
    str = str.replace(',', ' ');
    int[] next = new int[1];
    return new Point4f(Parser.parseFloat(str, next), Parser.parseFloat(str,
        next), Parser.parseFloat(str, next), Parser.parseFloat(str, next));
  }
  return null;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:Jvxl.java


示例2: isVariableType

import javax.vecmath.Point4f; //导入依赖的package包/类
static public boolean isVariableType(Object x) {
  return (x instanceof ScriptVariable
      || x instanceof BitSet
      || x instanceof Boolean
      || x instanceof Float
      || x instanceof Integer
      || x instanceof Point3f    // stored as point3f
      || x instanceof Vector3f   // stored as point3f
      || x instanceof Point4f    // stored as point4f
      || x instanceof Quaternion // stored as point4f
      || x instanceof String
      || x instanceof Map<?, ?>  // stored as Map<String, ScriptVariable>
      || x instanceof List<?>    // stored as list
      || x instanceof ScriptVariable[] // stored as list
      || x instanceof double[]   // stored as list
      || x instanceof float[]    // stored as list
      || x instanceof Float[]    // stored as list
      || x instanceof int[]      // stored as list
      || x instanceof int[][]    // stored as list
      || x instanceof Point4f[]  // stored as list
      || x instanceof String[]); // stored as list
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:ScriptVariable.java


示例3: planeValue

import javax.vecmath.Point4f; //导入依赖的package包/类
private Point4f planeValue(Token x) {
  if (isSyntaxCheck)
    return new Point4f();
  switch (x.tok) {
  case Token.point4f:
    return (Point4f) x.value;
  case Token.varray:
  case Token.string:
    Object pt = Escape.unescapePoint(ScriptVariable.sValue(x));
    return (pt instanceof Point4f ? (Point4f) pt : null);
  case Token.bitset:
    // ooooh, wouldn't THIS be nice!
    break;
  }
  return null;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:ScriptMathProcessor.java


示例4: evaluatePoint

import javax.vecmath.Point4f; //导入依赖的package包/类
private boolean evaluatePoint(ScriptVariable[] args) {
  if (args.length != 1 && args.length != 3 && args.length != 4)
    return false;
  switch (args.length) {
  case 1:
    if (args[0].tok == Token.decimal || args[0].tok == Token.integer)
      return addX(Integer.valueOf(ScriptVariable.iValue(args[0])));
    Object pt = Escape.unescapePoint(ScriptVariable.sValue(args[0]));
    if (pt instanceof Point3f)
      return addX((Point3f) pt);
    return addX("" + pt);
  case 3:
    return addX(new Point3f(ScriptVariable.fValue(args[0]), ScriptVariable
        .fValue(args[1]), ScriptVariable.fValue(args[2])));
  case 4:
    return addX(new Point4f(ScriptVariable.fValue(args[0]), ScriptVariable
        .fValue(args[1]), ScriptVariable.fValue(args[2]), ScriptVariable
        .fValue(args[3])));
  }
  return false;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:22,代码来源:ScriptMathProcessor.java


示例5: getQuaternionArray

import javax.vecmath.Point4f; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected static Quaternion[] getQuaternionArray(Object quaternionOrSVData) {
  Quaternion[] data;
  if (quaternionOrSVData instanceof Quaternion[]) {
    data = (Quaternion[]) quaternionOrSVData;
  } else if (quaternionOrSVData instanceof Point4f[]) {
    Point4f[] pts = (Point4f[]) quaternionOrSVData;
    data = new Quaternion[pts.length];
    for (int i = 0; i < pts.length; i++)
      data[i] = new Quaternion(pts[i]);
  } else if (quaternionOrSVData instanceof List<?>) {
    List<ScriptVariable> sv = (ArrayList<ScriptVariable>) quaternionOrSVData;
    data = new Quaternion[sv.size()];
    for (int i = 0; i < sv.size(); i++) {
      Point4f pt = ScriptVariable.pt4Value(sv.get(i));
      if (pt == null)
        return null;
      data[i] = new Quaternion(pt);
    }
  } else {
    return null;
  }
  return data;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:ScriptMathProcessor.java


示例6: capData

import javax.vecmath.Point4f; //导入依赖的package包/类
public void capData(Point4f plane, float cutoff) {
  if (voxelData == null)
    return;
  int nx = voxelCounts[0];
  int ny = voxelCounts[1];
  int nz = voxelCounts[2];
  Vector3f normal = new Vector3f(plane.x, plane.y, plane.z);
  normal.normalize();
  float f = 1f;
  for (int x = 0; x < nx; x++)
    for (int y = 0; y < ny; y++)
      for (int z = 0; z < nz; z++) {
        float value = voxelData[x][y][z] - cutoff;
        voxelPtToXYZ(x, y, z, ptXyzTemp);
        float d = (ptXyzTemp.x * normal.x + ptXyzTemp.y * normal.y + ptXyzTemp.z * normal.z + plane.w - cutoff) / f;
        if (d >= 0 || d > value)
          voxelData[x][y][z] = d;
      }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:VolumeData.java


示例7: setup

import javax.vecmath.Point4f; //导入依赖的package包/类
@Override
protected void setup() {
  functionName = (String) params.functionXYinfo.get(0);
  jvxlFileHeaderBuffer = new StringBuffer();
  jvxlFileHeaderBuffer.append("functionXYZ\n").append(functionName).append("\n");
  volumetricOrigin.set((Point3f) params.functionXYinfo.get(1));
  for (int i = 0; i < 3; i++) {
    Point4f info = (Point4f) params.functionXYinfo.get(i + 2);
    voxelCounts[i] = Math.abs((int) info.x);
    volumetricVectors[i].set(info.y, info.z, info.w);      
  }
  if (isAnisotropic)
    setVolumetricAnisotropy();
  data = (float[][][]) params.functionXYinfo.get(5);
  JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(volumeData, jvxlFileHeaderBuffer);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:IsoFxyzReader.java


示例8: setup

import javax.vecmath.Point4f; //导入依赖的package包/类
@Override
protected void setup() {
  isPlanarMapping = (params.thePlane != null || params.state == Parameters.STATE_DATA_COLORED);
  functionName = (String) params.functionXYinfo.get(0);
  jvxlFileHeaderBuffer = new StringBuffer();
  jvxlFileHeaderBuffer.append("functionXY\n").append(functionName).append("\n");
  volumetricOrigin.set((Point3f) params.functionXYinfo.get(1));
  for (int i = 0; i < 3; i++) {
    Point4f info = (Point4f) params.functionXYinfo.get(i + 2);
    voxelCounts[i] = Math.abs((int) info.x);
    volumetricVectors[i].set(info.y, info.z, info.w);      
  }
  if (isAnisotropic)
    setVolumetricAnisotropy();
  
  data = (float[][]) params.functionXYinfo.get(5);
  JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(volumeData, jvxlFileHeaderBuffer);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:IsoFxyReader.java


示例9: generateCube

import javax.vecmath.Point4f; //导入依赖的package包/类
@Override
protected void generateCube() {
  // This is the starting point for the calculation.
  volumeData.getYzCount();
  if (isCavity && params.theProperty != null)
    return;
  Logger.startTimer();
  getMaxRadius();
  if (isCavity && dataType != Parameters.SURFACE_NOMAP
      && dataType != Parameters.SURFACE_PROPERTY) {
    volumeData.voxelData = voxelData = new float[nPointsX][nPointsY][nPointsZ];
    resetVoxelData(Float.MAX_VALUE);
    markSphereVoxels(cavityRadius, params.distance);
    generateSolventCavity();
    resetVoxelData(Float.MAX_VALUE);
    markSphereVoxels(0, Float.NaN);
  } else {
    generateSolventCube();
  }
  unsetVoxelData();
  if (params.cappingObject instanceof Point4f) {
    volumeData.capData((Point4f) params.cappingObject, params.cutoff);
    params.cappingObject = null;
  }
  Logger.checkTimer("solvent surface time");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:IsoSolventReader.java


示例10: MarchingSquares

import javax.vecmath.Point4f; //导入依赖的package包/类
/**
 * 
 * @param surfaceReader
 * @param volumeData
 * @param thePlane   NOT USED
 * @param contoursDiscrete
 * @param nContours
 * @param thisContour
 * @param contourFromZero
 */
public MarchingSquares(VertexDataServer surfaceReader, VolumeData volumeData,
    Point4f thePlane, float[] contoursDiscrete, int nContours,
    int thisContour, boolean contourFromZero) {
  this.surfaceReader = surfaceReader;
  this.volumeData = volumeData;
  this.thisContour = thisContour;
  this.contoursDiscrete = contoursDiscrete;
  this.contourFromZero = contourFromZero; // really just a stand-in for "!fullPlane" //set false for MEP to complete the plane
  if (contoursDiscrete == null) {
    int i = 0;// DEAD CODE (true ? 0 : contourFromZero ? 1  : is3DContour ? 1 : 2);
    nContourSegments = (nContours == 0 ? defaultContourCount : nContours) + i;
    if (nContourSegments > nContourMax)
      nContourSegments = nContourMax;
  } else {
    nContours = contoursDiscrete.length;
    nContourSegments = nContours;
    this.contourFromZero = false;
  }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:30,代码来源:MarchingSquares.java


示例11: getSettings

import javax.vecmath.Point4f; //导入依赖的package包/类
private boolean getSettings(String strID) {
  thisModel = htModels.get(strID);
  if (thisModel == null || thisModel.get("moNumber") == null)
    return false;
  moTranslucency = (String) thisModel.get("moTranslucency");
  moTranslucentLevel = (Float) thisModel.get("moTranslucentLevel");
  moPlane = (Point4f) thisModel.get("moPlane");
  moCutoff = (Float) thisModel.get("moCutoff");
  if (moCutoff == null)
    moCutoff = (Float) sg.getMoData().get("defaultCutoff");
  if (moCutoff == null) {
    moCutoff = new Float(Parameters.defaultQMOrbitalCutoff);
  }
  thisModel.put("moCutoff", new Float(moCutoff.floatValue()));
  moResolution = (Float) thisModel.get("moResolution");
  moScale = (Float) thisModel.get("moScale");
  moColorPos = (Integer) thisModel.get("moColorPos");
  moColorNeg = (Integer) thisModel.get("moColorNeg");
  moNumber = ((Integer) thisModel.get("moNumber")).intValue();
  moLinearCombination = (float[]) thisModel.get("moLinearCombination");
  Object b = thisModel.get("moIsPositiveOnly");
  moIsPositiveOnly = (b != null && ((Boolean) (b)).booleanValue());
  return true;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:MolecularOrbital.java


示例12: isInTetrahedron

import javax.vecmath.Point4f; //导入依赖的package包/类
public static boolean isInTetrahedron(Point3f pt, Point3f ptA, Point3f ptB,
                                      Point3f ptC, Point3f ptD,
                                      Point4f plane, Vector3f vTemp,
                                      Vector3f vTemp2, Vector3f vTemp3, boolean fullyEnclosed) {
  getPlaneThroughPoints(ptC, ptD, ptA, vTemp, vTemp2, vTemp3, plane);
  boolean b = (distanceToPlane(plane, pt) >= 0);
  getPlaneThroughPoints(ptA, ptD, ptB, vTemp, vTemp2, vTemp3, plane);
  if (b != (distanceToPlane(plane, pt) >= 0))
    return false;
  getPlaneThroughPoints(ptB, ptD, ptC, vTemp, vTemp2, vTemp3, plane);
  if (b != (distanceToPlane(plane, pt) >= 0))
    return false;
  getPlaneThroughPoints(ptA, ptB, ptC, vTemp, vTemp2, vTemp3, plane);
  float d = distanceToPlane(plane, pt);
  if (fullyEnclosed)
    return (b == (d >= 0));
  float d1 = distanceToPlane(plane, ptD);
  return d1 * d <= 0 || Math.abs(d1) > Math.abs(d);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:Measure.java


示例13: unescapePoint

import javax.vecmath.Point4f; //导入依赖的package包/类
public static Object unescapePoint(String strPoint) {
  if (strPoint == null || strPoint.length() == 0)
    return strPoint;
  String str = strPoint.replace('\n', ' ').trim();
  if (str.charAt(0) != '{' || str.charAt(str.length() - 1) != '}')
    return strPoint;
  float[] points = new float[5];
  int nPoints = 0;
  str = str.substring(1, str.length() - 1);
  int[] next = new int[1];
  for (; nPoints < 5; nPoints++) {
    points[nPoints] = Parser.parseFloat(str, next);
    if (Float.isNaN(points[nPoints])) {
      if (next[0] >= str.length() || str.charAt(next[0]) != ',')
        break;
      next[0]++;
      nPoints--;
    }
  }
  if (nPoints == 3)
    return new Point3f(points[0], points[1], points[2]);
  if (nPoints == 4)
    return new Point4f(points[0], points[1], points[2], points[3]);
  return strPoint;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:Escape.java


示例14: slabPolygons

import javax.vecmath.Point4f; //导入依赖的package包/类
public void slabPolygons(Object slabbingObject, boolean andCap) {
  if (slabbingObject instanceof Point4f) {
    getIntersection((Point4f) slabbingObject, null, 0, null, andCap, false);
    return;
  }
  if (slabbingObject instanceof Point3f[]) {
    Point4f[] faces = BoxInfo.getFacesFromCriticalPoints((Point3f[]) slabbingObject);
    for (int i = 0; i < faces.length; i++)
      getIntersection(faces[i], null, 0, null, andCap, false);
    return; 
  }
  if (slabbingObject instanceof Object[]) {
    Object[] o = (Object[]) slabbingObject;
    float distance = ((Float) o[0]).floatValue();
    Point3f center = (Point3f) o[1];
    getIntersection(null, center, distance, null, andCap, false);
  }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:MeshSurface.java


示例15: simpleAverage

import javax.vecmath.Point4f; //导入依赖的package包/类
/**
 * Just a starting point.
 * get average normal vector
 * scale normal by average projection of vectors onto it
 * create quaternion from this 3D projection
 * 
 * @param ndata
 * @return approximate average
 */
private static Quaternion simpleAverage(Quaternion[] ndata) {
  Vector3f mean = new Vector3f(0, 0, 1);
  // using the directed normal ensures that the mean is 
  // continually added to and never subtracted from 
  Vector3f v = ndata[0].getNormal();
  mean.add(v);
  for (int i = ndata.length; --i >= 0;)
    mean.add(ndata[i].getNormalDirected(mean));
  mean.sub(v);
  mean.normalize();
  float f = 0;
  // the 3D projection of the quaternion is [sin(theta/2)]*n
  // so dotted with the normalized mean gets us an approximate average for sin(theta/2)
  for (int i = ndata.length; --i >= 0;)
    f += Math.abs(ndata[i].get3dProjection(v).dot(mean)); 
  if (f != 0)
    mean.scale(f / ndata.length);
  // now convert f to the corresponding cosine instead of sine
  f = (float) Math.sqrt(1 - mean.lengthSquared());
  if (Float.isNaN(f))
    f = 0;
  return new Quaternion(new Point4f(mean.x, mean.y, mean.z, f));
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:33,代码来源:Quaternion.java


示例16: initialize

import javax.vecmath.Point4f; //导入依赖的package包/类
public void initialize(int lighting, Point3f[] vertices, Point4f plane) {
  if (vertices == null)
    vertices = this.vertices;
  Vector3f[] normals = getNormals(vertices, plane);
  normixes = new short[normixCount];
  isTwoSided = (lighting == JmolConstants.FULLYLIT);
  BitSet bsTemp = new BitSet();
  if (haveXyPoints)
    for (int i = normixCount; --i >= 0;)
      normixes[i] = Graphics3D.NORMIX_NULL;
  else
    for (int i = normixCount; --i >= 0;)
      normixes[i] = Graphics3D.getNormix(normals[i], bsTemp);
  this.lighting = JmolConstants.FRONTLIT;
  if (insideOut)
    invertNormixes();
  setLighting(lighting);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:Mesh.java


示例17: getNormals

import javax.vecmath.Point4f; //导入依赖的package包/类
public Vector3f[] getNormals(Point3f[] vertices, Point4f plane) {
  normixCount = (isPolygonSet ? polygonCount : vertexCount);
  Vector3f[] normals = new Vector3f[normixCount];
  for (int i = normixCount; --i >= 0;)
    normals[i] = new Vector3f();
  if (plane == null) {
    sumVertexNormals(vertices, normals);
  }else {
    Vector3f normal = new Vector3f(plane.x, plane.y, plane.z); 
    for (int i = normixCount; --i >= 0;)
      normals[i] = normal;
  }
  if (!isPolygonSet)
    for (int i = normixCount; --i >= 0;)
      normals[i].normalize();
  return normals;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:Mesh.java


示例18: getPlaneIntersection

import javax.vecmath.Point4f; //导入依赖的package包/类
/**
 * 
 * @param type
 * @param plane
 * @param scale
 * @param modelIndex
 * @param flags
 *          1 -- edges only 2 -- triangles only 3 -- both
 * @return Vector
 */
public List<Object> getPlaneIntersection(int type, Point4f plane, float scale,
                                   int flags, int modelIndex) {
  Point3f[] pts = null;
  switch (type) {
  case Token.unitcell:
    SymmetryInterface uc = getUnitCell(modelIndex);
    if (uc == null)
      return null;
    pts = uc.getCanonicalCopy(scale);
    break;
  case Token.boundbox:
    pts = boxInfo.getCanonicalCopy(scale);
    break;
  }
  List<Object> v = new ArrayList<Object>();
  v.add(pts);
  return TriangleData.intersectPlane(plane, v, flags);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:29,代码来源:ModelCollection.java


示例19: outputCone

import javax.vecmath.Point4f; //导入依赖的package包/类
@Override
protected void outputCone(Point3f screenBase, Point3f screenTip,
                          float radius, short colix, boolean isBarb) {
  if (isBarb) {
    if (!haveMacros)
      writeMacros2();
    Point4f plane = new Point4f();
    tempP1.set(screenBase.x, screenTip.y, 12345.6789f);
    Measure.getPlaneThroughPoints(screenBase, screenTip, tempP1, tempV1,
        tempV2, tempV3, plane);
    output("barb(" + triad(screenBase) + "," + radius + ","
        + triad(screenTip) + ",0" + "," + color4(colix) + "," + plane.x + ","
        + plane.y + "," + plane.z + "," + -plane.w + ")\n");
  } else {
    output("b(" + triad(screenBase) + "," + radius + "," + triad(screenTip)
        + ",0" + "," + color4(colix) + ")\n");
  }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:_PovrayExporter.java


示例20: mapWorldToScreen

import javax.vecmath.Point4f; //导入依赖的package包/类
/**
   * Given a point in world coordinates, adjust it in place to be in
   * screen coordinates (after projection).
   * 
   * @param point
   */
  public void mapWorldToScreen( Camera view, Point3f point )
  {
      Matrix4d viewMatrix = new Matrix4d();
      this .view .getViewTransform( viewMatrix, 0d );
      Transform3D viewTrans = new Transform3D( viewMatrix );
      viewTrans .transform( point );
      // point is now in view coordinates
      Vector4f p4 = new Vector4f( point.x, point.y, point.z, 1f );

      Transform3D eyeTrans = new Transform3D();
      if ( ! view .isPerspective() ) {
	double edge = view .getWidth() / 2;
	eyeTrans .ortho( -edge, edge, -edge, edge, view .getNearClipDistance(), view .getFarClipDistance() );
}
else
    eyeTrans .perspective( view .getFieldOfView(), 1.0d, view .getNearClipDistance(), view .getFarClipDistance() );
	// TODO - make aspect ratio track the screen window shape
      
      eyeTrans .transform( p4 );
      point .project( new Point4f( p4 ) );
  }
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:28,代码来源:Java2dExporter.java



注:本文中的javax.vecmath.Point4f类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EaseChatMessageList类代码示例发布时间:2022-05-22
下一篇:
Java PictureData类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap