当前位置: 首页>>代码示例>>Java>>正文


Java PointArray类代码示例

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


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

示例1: makePointGeometry

import javax.media.j3d.PointArray; //导入依赖的package包/类
PointArray makePointGeometry( Connector ball, AlgebraicField field, Embedding embedding )
{
    PointArray result = new PointArray( 1, GeometryArray.COORDINATES );
    
    Point3d pt = new Point3d();
    AlgebraicVector gv = null;
    RealVector v = null;
    
    gv = ball .getLocation();

    v = embedding .embedInR3( gv );
    pt.x = v.x; pt.y = v.y; pt.z = v.z;
    result .setCoordinate( 0, pt );
    
    return result;
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:17,代码来源:Java3dWireframeFactory.java

示例2: setupFinished

import javax.media.j3d.PointArray; //导入依赖的package包/类
/**
 * Notification that the construction phase of this node has finished.
 * If the node would like to do any internal processing, such as setting
 * up geometry, then go for it now.
 */
public void setupFinished() {
    if(!inSetup)
        return;

    super.setupFinished();

    int num_points = numPoint / 2;
    float[] coords = new float[num_points * 3];
    for(int i = 0; i < num_points; i++) {
        coords[i * 3] = vfPoint[i * 2];
        coords[i * 3 + 1] = vfPoint[i * 2 + 1];
        coords[i * 3 + 2] = 0;
    }

    implGeom = new PointArray(num_points, PointArray.COORDINATES);
    implGeom.setCoordinates(0, coords);
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:23,代码来源:J3DPolypoint2D.java

示例3: setColorNode

import javax.media.j3d.PointArray; //导入依赖的package包/类
/**
 * Notification of the color node being set. If the passed value is
 * null then that clears the node. The node passed is the actual color,
 * not any proto wrapper, that will have been previously stripped. The
 * default implementation does nothing.
 *
 * @param node The node to use
 */
protected void setColorNode(VRMLColorNodeType node) {

    if(!inSetup)
        return;

    float[] color_vals = null;

    if(node != null) {
        color_vals = new float[node.getNumColors()];
        node.getColor(color_vals);
    }

    PointArray new_render = updateColor(color_vals);

    if(new_render != implGeom) {
        implGeom = new_render;
        fireGeometryChanged(GEOM_CHANGED_INDEX);
    }
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:28,代码来源:J3DPointSet.java

示例4: PointsShape

import javax.media.j3d.PointArray; //导入依赖的package包/类
public PointsShape() {
	// BY_REFERENCE PointArray storing coordinates and colors
	cloud = new PointArray(MAX_POINTS, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.BY_REFERENCE);
	mesh = new TriangleArray(MAX_POINTS, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.BY_REFERENCE);

	TransparencyAttributes ta = new TransparencyAttributes();
	ta.setTransparencyMode(TransparencyAttributes.NICEST);
	ta.setTransparency(0.0f);

	PointAttributes pointAttributes = new PointAttributes();
	pointAttributes.setPointSize(2.83f);
	pointAttributes.setCapability(PointAttributes.ALLOW_SIZE_WRITE);

	Appearance a = new Appearance();
	a.setPointAttributes(pointAttributes);
	a.setTransparencyAttributes(ta);

	// the data structure can be read and written at run time
	cloud.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
	cloud.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);

	mesh.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
	mesh.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);

	sem = new Semaphore(0);

	// create PointsShape geometry and appearance
	createGeometry();
	createAppearance();
	// setAppearance(a);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:32,代码来源:PointsShape.java

示例5: PointsShape

import javax.media.j3d.PointArray; //导入依赖的package包/类
public PointsShape() {
  // BY_REFERENCE PointArray storing coordinates and colors
  cloud = new PointArray(MAX_POINTS, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.BY_REFERENCE);
  mesh = new TriangleArray(MAX_POINTS, GeometryArray.COORDINATES | GeometryArray.COLOR_3 | GeometryArray.BY_REFERENCE);

  TransparencyAttributes ta = new TransparencyAttributes();
  ta.setTransparencyMode(TransparencyAttributes.NICEST);
  ta.setTransparency(0.0f);

  PointAttributes pointAttributes = new PointAttributes();
  pointAttributes.setPointSize(2.83f);
  pointAttributes.setCapability(PointAttributes.ALLOW_SIZE_WRITE);

  Appearance a = new Appearance();
  a.setPointAttributes(pointAttributes);
  a.setTransparencyAttributes(ta);

  // the data structure can be read and written at run time
  cloud.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
  cloud.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);

  mesh.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
  mesh.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);

  sem = new Semaphore(0);

  // create PointsShape geometry and appearance
  createGeometry();
  createAppearance();
  // setAppearance(a);
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:32,代码来源:PointsShape.java

示例6: setCoordinateNode

import javax.media.j3d.PointArray; //导入依赖的package包/类
/**
 * Notification of the coordinate node being set. If the passed value is
 * null then that clears the node. The node passed is the actual geometry,
 * not any proto wrapper, that will have been previously stripped. The
 * default implementation does nothing.
 *
 * @param node The node to use
 */
protected void setCoordinateNode(VRMLCoordinateNodeType node) {
    if(inSetup)
        return;

    if(node == null) {
        fireGeometryRemoved(null);
    } else {
        float[] points = vfCoord.getPointRef();
        int num = vfCoord.getNumPoints();

        PointArray new_render = updateGeometry(points, num);

        // If the update changed the geometry, we want to send off an
        // event to the listeners.
        if(new_render != implGeom) {
            if(implGeom == null) {
                numPoints = num;
                fireGeometryAdded(null);
            } else if(new_render == null) {
                numPoints = 0;
                fireGeometryRemoved(GEOM_CHANGED_INDEX);
            } else {
                numPoints = num;
                fireGeometryChanged(GEOM_CHANGED_INDEX);
            }
        }
    }
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:37,代码来源:J3DPointSet.java

示例7: updateGeometry

import javax.media.j3d.PointArray; //导入依赖的package包/类
/**
 * Update the render geometry based on the new set of coordinates. This assumes
 * that we have a valid piece of geometry that we want to update. That is,
 * it will re-allocate a geometry array if one already exists.
 * <p>
 * If the array passed is null or less than 3 in length, we delete the
 * geometry as it is not able to be shown.
 * <p>
 * The return value may be:<br>
 * null: indicating that the point array should not be used for this set
 * of coordinates<br>
 * The current reference to implGeom indicating that we've just change
 * the internal values.<br>
 * A new geometry instance because the old one is not compatible with the
 * the requirements for these coordinates.
 *
 * @param coords The new coordinate array to use
 * @param numCoords The number of float values in coord
 * @return A reference to an updated PointArray
 */
private PointArray updateGeometry(float[] coords, int numCoords) {
    float[] color_vals = null;
    PointArray ret_val = implGeom;

    // Do we have any coordinates or not enough?
    if((coords == null) || (numCoords < 3)) {
        ret_val = null;
    } else {
        if(vfColor != null) {
            color_vals = new float[vfColor.getNumColors()];
            vfColor.getColor(color_vals);
            usedColor = (color_vals.length >= coords.length);
        }

        // If the geometry length has changed, we will need to create
        // a new PointArray. Handles when the previous geometry item
        // was null because it wasn't set.
        if(numCoords != numPoints && numPoints > 0)
            ret_val = createPointArray(numPoints);

        if (ret_val != null) {
            // now setup the points.
            ret_val.setCoordinates(0, coords);

            if(usedColor)
                ret_val.setColors(0, color_vals, 0, numPoints);
        }
    }

    return ret_val;
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:52,代码来源:J3DPointSet.java

示例8: geometryWithColor

import javax.media.j3d.PointArray; //导入依赖的package包/类
/**
 * 
 * Permet de créer une géométrie Java3D à partir d'une apparence
 * 
 * @param ap
 * @return
 */
private ArrayList<TransformGroup> geometryWithColor(Appearance ap) {
  // On récupère la géométrie sous forme de points
  IGeometry geom = this.feat.getGeom();

  if (geom instanceof GM_MultiPoint) {

    // On peut àventuellement vouloir ajouter des traitements

  } else if (geom instanceof GM_Point) {

    // On peut àventuellement vouloir ajouter des traitements
  } else {
    Object0d.logger.warn(Messages.getString("Representation.GeomUnk"));
    return null;
  }

  IDirectPositionList lDP = geom.coord();

  int nbPoints = lDP.size();

  PointArray pA = new PointArray(nbPoints, GeometryArray.COORDINATES
      | GeometryArray.COLOR_3);

  ArrayList<TransformGroup> lTG = new ArrayList<TransformGroup>(nbPoints);
  Object0d.logger.debug(nbPoints);
  pA.setCapability(GeometryArray.ALLOW_COLOR_READ);
  pA.setCapability(GeometryArray.ALLOW_COLOR_WRITE);

  for (int i = 0; i < nbPoints; i++) {

    // On crée la sphère et on lui applique l'apparence choisie
    Sphere s = new Sphere(Object0d.RADIUS, ap);

    s.setCapability(Primitive.ENABLE_APPEARANCE_MODIFY);
    s.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    s.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

    s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

    IDirectPosition pTemp = lDP.get(i);

    // On place le centre de la sphère aux bonnes coordonnées
    Transform3D translate = new Transform3D();
    translate.set(new Vector3f((float) pTemp.getX(), (float) pTemp.getY(),
        (float) pTemp.getZ()));

    TransformGroup TG1 = new TransformGroup(translate);
    TG1.addChild(s);

    lTG.add(TG1);
    // On complète la liste des sphères
    this.lShape.add(s);

  }

  return lTG;

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:67,代码来源:Object0d.java

示例9: geometryWithOutColor

import javax.media.j3d.PointArray; //导入依赖的package包/类
/**
 * Génère une représentation avec une couleur pour chaque sphère
 * 
 * @param ap
 * @return
 */
private ArrayList<TransformGroup> geometryWithOutColor(Appearance ap) {
  // On décompose sous forme de points la géométrie
  IGeometry geom = this.feat.getGeom();
  if (geom instanceof GM_MultiPoint) {

    // On peut àventuellement vouloir ajouter des traitements

  } else if (geom instanceof GM_Point) {
    // On peut àventuellement vouloir ajouter des traitements

  } else {
    Object0d.logger.warn(Messages.getString("Representation.GeomUnk"));
    return null;
  }
  IDirectPositionList lDP = geom.coord();

  int nbPoints = lDP.size();

  PointArray pA = new PointArray(nbPoints, GeometryArray.COORDINATES
      | GeometryArray.COLOR_3);

  ArrayList<TransformGroup> lTG = new ArrayList<TransformGroup>(nbPoints);

  pA.setCapability(GeometryArray.ALLOW_COLOR_READ);
  pA.setCapability(GeometryArray.ALLOW_COLOR_WRITE);

  for (int i = 0; i < nbPoints; i++) {

    Sphere s = new Sphere(Object0d.RADIUS, ap);

    // on ajoute une couleur aléatoire
    ColoringAttributes CA = new ColoringAttributes(new Color3f(
        (float) Math.random(), (float) Math.random(), (float) Math.random()),
        ColoringAttributes.SHADE_GOURAUD);
    ap.setColoringAttributes(CA);

    s.setCapability(Primitive.ENABLE_APPEARANCE_MODIFY);
    s.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    s.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

    s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_READ);
    s.getShape().setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);

    IDirectPosition pTemp = lDP.get(i);

    // On place le sphère aux bonnes coordonnées
    Transform3D translate = new Transform3D();
    translate.set(new Vector3f((float) pTemp.getX(), (float) pTemp.getY(),
        (float) pTemp.getZ()));

    TransformGroup TG1 = new TransformGroup(translate);
    TG1.addChild(s);

    lTG.add(TG1);
    this.lShape.add(s);

  }

  return lTG;

}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:68,代码来源:Object0d.java

示例10: manifestationAdded

import javax.media.j3d.PointArray; //导入依赖的package包/类
@Override
    public void manifestationAdded( RenderedManifestation rm )
    {
//        int[] /* AlgebraicVector */location = rm.getManifestation().getLocation();
//        if ( location == null )
//            location = rm.getShape().getField().origin( 3 );
    	    	
        RealVector loc = rm .getLocation();
        if ( loc == null )
            loc = new RealVector( 0d, 0d, 0d );
        
        Appearance appearance = mFactory .getAppearance( rm.getColor(), rm.getGlow() > 0f, rm.getTransparency() > 0f );
        Geometry geom = mFactory .makeSolidGeometry( rm );
        
        if ( logger .isLoggable( Level.FINEST )
                && rm .getManifestation() == null )
        {
            Direction orbit = rm .getShape() .getOrbit();
            String shape = ( orbit == null )? "BALL" : orbit .getName() + " strut";
            logger .finest( shape + " at " + loc );
        }
        
        // if we rendering wireframe, we're using absolute coordinates
        if ( ( geom instanceof PointArray ) || ( geom instanceof LineArray ) )
//            location = rm.getShape().getField().origin( 3 );
            loc = new RealVector( 0d, 0d, 0d );
        
        Shape3D solidPolyhedron = new Shape3D( geom );
        solidPolyhedron .setCapability( Shape3D.ALLOW_APPEARANCE_WRITE );
        solidPolyhedron .setAppearance( appearance );
        solidPolyhedron .setUserData( rm );

        // omit this if trying to pre-optimize with makeGeometryAt
        Transform3D move = new Transform3D();
        move.setTranslation( new Vector3d( loc.x, loc.y, loc.z ) );
        TransformGroup tg = new TransformGroup( move );
        tg.setCapability( Group.ALLOW_CHILDREN_EXTEND );
        tg.setCapability( Group.ALLOW_CHILDREN_READ );
        tg.setCapability( Group.ALLOW_CHILDREN_WRITE );
        tg.setCapability( BranchGroup.ALLOW_DETACH );
        tg.setCapability( Shape3D.ENABLE_PICK_REPORTING );
        tg.setPickable( true );
        tg.addChild( solidPolyhedron );

        if ( drawOutlines ) {
        	geom = mFactory .makeOutlineGeometry( rm );
            Shape3D outlinePolyhedron = new Shape3D( geom );
            outlinePolyhedron .setAppearance( mFactory .getOutlineAppearance() );
        	tg .addChild( outlinePolyhedron );
        }

        // Create a Text2D leaf node, add it to the scene graph.
        // Text2D text2D = new Text2D( "     label", new Color3f( 0.9f, 1.0f,
        // 0.0f),
        // "Helvetica", 36, Font.ITALIC );
        // text2D .setRectangleScaleFactor( 0.02f );
        // text2D .getGeometry() .setCapability( Geometry .ALLOW_INTERSECT );
        // OrientedShape3D os3D = new OrientedShape3D();
        // os3D .setGeometry( text2D.getGeometry() );
        // os3D .setAppearance( text2D.getAppearance() );
        // os3D .setAlignmentMode( OrientedShape3D.ROTATE_ABOUT_POINT );
        // tg .addChild( os3D );

        BranchGroup group = new BranchGroup();
        group.setCapability( Group.ALLOW_CHILDREN_EXTEND );
        group.setCapability( Group.ALLOW_CHILDREN_READ );
        group.setCapability( Group.ALLOW_CHILDREN_WRITE );
        group.setCapability( Node.ENABLE_PICK_REPORTING );
        group.setCapability( BranchGroup.ALLOW_DETACH );
        group.addChild( tg );

        mScene.addChild( group );
        if ( this .isSticky )
            rm.setGraphicsObject( group );
    }
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:76,代码来源:Java3dSceneGraph.java

示例11: createSceneGraph

import javax.media.j3d.PointArray; //导入依赖的package包/类
/**
 * �V�[�����\�z����
 * 
 * @return BG
 */
public BranchGroup createSceneGraph() {
    BranchGroup bg = new BranchGroup();

    // ������3D�I�u�W�F�N�g��lj�

    // ���W����lj�
    Axis axis = new Axis();
    bg.addChild(axis.getBG());

    // �_��lj�
    Point3f[] vertices = { // �_�̍��W
            new Point3f(-0.5f, 0.5f, -0.5f),
            new Point3f(0.5f, 0.5f, -0.5f),
            new Point3f(0.5f, 0.5f, 0.5f),
            new Point3f(-0.5f, 0.5f, 0.5f),
            new Point3f(-0.5f, -0.5f, -0.5f),
            new Point3f(0.5f, -0.5f, -0.5f),
            new Point3f(0.5f, -0.5f, 0.5f),
            new Point3f(-0.5f, -0.5f, 0.5f)
    };

    Color3f[] colors = { // �_�̐F
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f),
            new Color3f(1.0f, 1.0f, 0.0f)
    };

    // Geometry
    PointArray geo = new PointArray(8, PointArray.COORDINATES
            | PointArray.COLOR_3);
    geo.setCoordinates(0, vertices); // ���_���W���Z�b�g
    geo.setColors(0, colors); // �F���Z�b�g

    // Appearance
    Appearance app = new Appearance();
    PointAttributes attr = new PointAttributes(5.0f, false); // �_�̑傫��
    app.setPointAttributes(attr);

    bg.addChild(new Shape3D(geo, app));

    // �����܂�

    return bg;
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:55,代码来源:Main3D.java

示例12: notifyExternProtoLoaded

import javax.media.j3d.PointArray; //导入依赖的package包/类
/**
 * Notify a node that an ExternProto has resolved.  This will verify the objects
 * type and add it to the render sceneGraph.
 *
 * @param index The field index
 * @throws InvalidFieldValueException If the proto contains he wrong type
 */
 public void notifyExternProtoLoaded(int index, VRMLNodeType node)
    throws InvalidFieldValueException {

    if(inSetup)
        return;

    PointArray new_render;
    int num_items;

    switch(index) {
        case FIELD_COLOR:
            int[] alt_type = node.getSecondaryType();
            boolean found_type = false;

            for(int i = 0; i < alt_type.length && !found_type; i++) {
                if(alt_type[i] == TypeConstants.ColorNodeType)
                    found_type = true;
            }

            if(!found_type)
                throw new InvalidFieldValueException(COLOR_PROTO_MSG);

            colorChanged = true;

            pColor = (VRMLProtoInstance)node;
            vfColor = (VRMLColorNodeType)pColor.getImplementationNode();

            if(!inSetup)
                stateManager.addEndOfThisFrameListener(this);
            break;

        case FIELD_COORD:
            alt_type = node.getSecondaryType();
            found_type = false;

            for(int i = 0; i < alt_type.length && !found_type; i++) {
                if(alt_type[i] == TypeConstants.CoordinateNodeType)
                    found_type = true;
            }

            if(!found_type)
                throw new InvalidFieldValueException(COORD_PROTO_MSG);

            coordChanged = true;

            pCoord = (VRMLProtoInstance)node;
            vfCoord = (VRMLCoordinateNodeType)pCoord.getImplementationNode();

            if(!inSetup)
                stateManager.addEndOfThisFrameListener(this);
            break;

        default:
            System.out.println("J3DPointSet: Unknown field for notifyExternProtoLoaded");
    }
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:64,代码来源:J3DPointSet.java


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