How to display polygons both with line contour and filled interior?

How to display polygons both with line contour and filled interior?
Java3D 1.3, Java 1.4.1-rc

Hi,
I just started with Java3D last week.
I assume you mean drawing polygons with outlines (wireframe) in one color and polygon face filling with another color. If so, I've got the same question! (I usually think of "contour" to refers to plotting surface intensity of independent data like temperature or elevation, but I don't think you mean this.)
The only solution I've found so far is to make two shapes with the same geometry.
Here's an example - an outlined and filled cube. I made it using a generalize class DualShape which is two shapes with the same geometry, but one filled and one as a line.
It works, although I can't say I understand the setPolygonOffset(), knowing what value to set. Without the command, the depthbuffer can't consistently decide which should be in front between the fills and lines so it looks bad.
I certainly think it would be nicer to do both internally, like:
pa.setPolygonMode(pa.POLYGON_LINE || pa.POLYGON_FILL);
And then have setFillColor and setLineColor for each.
I don't know why they don't allow this - maybe OpenGL can't do it like this so Java3D follows.
If anyone has any better ideas I'd like to hear about it.
Tom Ruen
class DualCube extends DualShape // cube with outline and fill colors
public DualCube(float ax, float ay, float az, //cube lower corner
float bx, float by, float bz, //cube upper corner
float br, float bg, float bb, //border color
float fr, float fg, float fb) //fill color
setGeometry(new CubeGeometry(ax,ay,az,bx,by,bz),br,bg,bb,fr,fg,fb);
class DualShape extends BranchGroup //general shape with outline and fill colors
Appearance ap1,ap2;
PolygonAttributes pa1,pa2;
ColoringAttributes ca1,ca2;
Shape3D s1,s2;
public void setGeometry(Geometry geo, float br, float bg, float bb, float fr, float fg, float fb)
//filled shape:
addChild(s1=new Shape3D(geo, ap1=new Appearance()));
ap1.setPolygonAttributes(pa1=new PolygonAttributes()); pa1.setPolygonMode(pa1.POLYGON_FILL);
ap1.setColoringAttributes(ca1=new ColoringAttributes()); ca1.setColor(fr,fg,fb);
//lined (wire) shape:
addChild(s2=new Shape3D(geo, ap2=new Appearance()));
ap2.setPolygonAttributes(pa2=new PolygonAttributes()); pa2.setPolygonMode(pa2.POLYGON_LINE);
ap2.setColoringAttributes(ca2=new ColoringAttributes()); ca2.setColor(br,bg,bb);
pa2.setPolygonOffset(-1000); //Uncertain what "float" value to use!
class CubeGeometry extends IndexedQuadArray //cube geometry data
private static final int[] faces =
0,3,2,1,
0,1,5,4,
1,2,6,5,
2,3,7,6,
3,0,4,7,
4,5,6,7
private static float[] verts = new float[24];
public CubeGeometry(float ax, float ay, float az, //lower limit
float bx, float by, float bz) //upper limit
super(8, IndexedQuadArray.COORDINATES , 24);
int n;
n=0; verts[n]=ax; verts[n+1]=ay; verts[n+2]=az;
n=3; verts[n]=bx; verts[n+1]=ay; verts[n+2]=az;
n=6; verts[n]=bx; verts[n+1]=by; verts[n+2]=az;
n=9; verts[n]=ax; verts[n+1]=by; verts[n+2]=az;
n=12; verts[n]=ax; verts[n+1]=ay; verts[n+2]=bz;
n=15; verts[n]=bx; verts[n+1]=ay; verts[n+2]=bz;
n=18; verts[n]=bx; verts[n+1]=by; verts[n+2]=bz;
n=21; verts[n]=ax; verts[n+1]=by; verts[n+2]=bz;
setCoordinates(0, verts);
setCoordinateIndices(0, faces);

Similar Messages

  • How to draw a shape with line tool then fill with colour

    How can i draw a shape with the line tool and then fill it with colour

    Click and drag from one anchor point to the next, making sure that each new line segment begins where the last one ended. The Line Tool will snap onto the anchors.
    Once you're done creating what looks like a closed path, the lines are still separate objects. To combine them into one path, select them all and press Ctrl/Cmd+J (for Join) or via the menu select Object > Path > Join.
    The Pen Tool can be used in a similar manner, but each segment will be a continuation rather than a separate object. The last (closing) click will be indicated by a tiny circle on the mouse pointer.
    If you make an open path, Ai will still "fill" it with a fill color by assuming a straight path between the last open anchor points. Individual straight paths, however, such as those drawn by the line tool, have no "inside", so they won't show the fill color even if you have assigned one.
    Allen

  • How to display html content with image in Adobe Flash and Flex mobile project?

    Hi,
      I have a html content with image in it. How to display it in Adobe Flash Builder and Flex mobile project? Which control needs to be used for this?

    Hello,
    The only current way is to use an iFrame, or if you only need some html tags you could use the Text Layout Framework.
    Here this is the iFrame approach:
    http://code.google.com/p/flex-iframe/
    If the swc do not work in Flex4 just use its ource code which works...
    ...it is basically based on this:
    http://www.deitte.com/archives/2008/07/dont_use_iframe.htm
    see also and vote, please:
    http://bugs.adobe.com/jira/browse/SDK-12291
    http://bugs.adobe.com/jira/browse/SDK-13740
    Regards
    Marc

  • I am just starting out in graphic design and I wanted to know how to get more involved with either adobe and or graphic design? I am really very interested in working with adobe and graphic design more and becoming more involved with both!!

    I am just starting out in graphic design and I wanted to know how to get more involved with either adobe and or graphic design? I am really very interested in working with adobe and graphic design more and becoming more involved with both!!

    I have now recently downloaded 10.0.2 which is confusing in itself, as, as far as I can ascertain that is actually version 11, but I'm not even sure about that.
    Version 10.0.2 is the newest version and the successor to GarageBand '11 (version 6.0.5).
    The '11 is referring to the iLife '11 suit of multimedia application - the older GarageBand was a part of this bundle.
    Have a look at Edgar's graphical enhanced manuals, the explain very detailed how things work and why. You can buy them as iBooks from the iBook store or directly from the page:
    http://DingDingMusic.com/Manuals/

  • How to display a cursor with sand glass ?

    I would like to know how to display a cursor with sand glass I am performing a long operation ?
    Thanks in advance.

    As long as you are using anything that extends Component...
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    doLongOperation();
    this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));Hope this helps,
    Radish21
    PS the API is ALWAYS your friend
    http://java.sun.com/j2se/1.4.1/docs/api/
    http://java.sun.com/j2se/1.4.1/docs/api/java/awt/Cursor.html

  • When turning on my mac book pro it displays a screen with apple logo and begins loading a loading bar, after this continues to show loading circle however has been like this all day still no different. Tried turning it on and off however still same!

    When turning on my mac book pro it displays a screen with apple logo and begins loading a loading bar, after this continues to show loading circle however has been like this all day still no different. Tried turning it on and off however still same!

    ... then run Disk Utility, Repair Disk.
    Also:
    Resolve startup issues and perform disk maintenance with Disk ...
    Mac troubleshooting FAQ: start-up woes
    How To Fix Common Mac Startup Problems
    Mac Stalls on Gray Screen at Startup - Troubleshooting Mac Startup ...

  • How do I composite with a matte and fill ?

    Hi all, If I have for example, a image of the desert for the background. And then I have a logo I want to add over it. And that logo comes with a matte and fill. How do I composite that over the desert image ? I've tried working with the (add image mask). But I cant fiqure it out.
    Again there are 2 seperate files for the matte and fill.
    Thanks for any replies

    Apply the image mask to the fill (select the fill layer, and choose Object > Add Image Mask). Then drag the matte layer into the well in the HUD (heads up display) and set it to Luma rather than the default of Alpha in the HUD's pop-up menu.

  • I am using a mini display to hdmi with my macbook and the display works fine. However, the sound will only play iTunes such as music and movies but when i go online to watch movies on youtube it will not play any sound. Please help

    I am using a mini display to hdmi with my macbook and the display works fine. However, the sound will only play iTunes such as music and movies but when i go online to watch movies on youtube it will not play any sound. Please help

    HDCP maybe? Read this http://www.macnn.com/articles/08/11/26/displayport.drm.conflict/

  • How can I use LCCS with ActionScript 3 and Flash CS4?

    Hi,
    Using Stratus I was able to create an an application using Action Script 3 and Flash CS4.  The sample code on the Adobe site was quite straight forward and easy to understand.  I now want to switch over to  LCCS but can't find anything any where on how to use Action Script 3 and Flash CS4 with LCCS.  Do I need to know Flex to be able to use LCCS?  Everything was quite simple and easy to understand with Stratus and makes complete sense.  But LCCS is really confusing.  Is there any sample code on how to establish a connection in Action Script 3 and then stream from a webcam to a client.  There is nothing in the  LCCS SDK that covers Flash and Action Script 3.  Please help!  I found the link below on some forum but it takes me nowhere.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=75 9&threadid=1407833&enterthread=y

    Thanks Arun!
    Date: Thu, 29 Apr 2010 11:44:10 -0600
    From: [email protected]
    To: [email protected]
    Subject: How can I use LCCS with ActionScript 3 and Flash CS4?
    Hi,
    Welcome to the LCCS world.
    Please refer to the SDK's sampleApps folder. There would be an app called FlashUserList. The app demonstrates how LCCS can be used with Flash CS4. Its a  pretty basic app, but should help you moving.
    We are trying to improve our efforts to help developers in understanding our samples. Please do let us know if we can add something that would help others.
    Thanks
    Arun
    >

  • How to create a table with datatype blob and insert a pdf file (ravi)

    how to create a table with datatype blob and insert a pdf file,
    give me the explain asap
    1.create the table?
    2.insert the pdffiles into tables?
    3.how to view the files?
    Thanks & Regards
    ravikumar.k
    Edited by: 895044 on Dec 5, 2011 2:55 AM

    895044 wrote:
    how to create a table with datatype blob and insert a pdf file,
    give me the explain asapPerhaps you should read...
    {message:id=9360002}
    especially point 2.
    We're not just sitting here waiting to answer your question as quickly as possible for you.

  • How to create a matrix with constant values and multiply it with the output of adc

    How to create a matrix with constant values and multiply it with the output of adc 

    nitinkajay wrote:
    How to create a matrix with constant values and multiply it with the output of adc 
    Place array constant on diagram, drag a double to it, r-click "add dimension". There, a constant 2D double array, a matrix.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • How to create 2D array with 3 rows and unlimit column?

    how to create 2D array with 3 rows and unlimit column?

    Here are images of what I described in my previous post
    Message Edited by JoeLabView on 11-14-2007 07:56 AM
    Attachments:
    2D-array_code.PNG ‏7 KB
    2D-array_values.PNG ‏13 KB

  • Using both at line-selection and at user-command

    hellow friends ,
    to use both  at line-selection and at user-command in the same report.

    Hello,
    U can do it like this.
    AT LINE-SELECTION.
      PERFORM at_line_selection.
    AT USER-COMMAND.
      PERFORM at_user_command.
    FORM AT_LINE_SELECTION.
      DATA: LV_CURSOR_FIELD(30).
      DATA: LV_MATNR TYPE MATNR.
      CLEAR H_UCOMM.
      GET CURSOR FIELD LV_CURSOR_FIELD.
      CASE LV_CURSOR_FIELD.
        WHEN 'PSPNR'.
          PERFORM LAGER_AN_PSP USING WA_MATNR-M1-RSNUM
                                     WA_MATNR-M1-RSPOS.
        WHEN 'PSPNR2'.
          H_UCOMM = 'PSPNR2'.
          IF NOT PSPNR2 IS INITIAL AND IT_VKBEL-VBELN CN '0123456789'.
            PERFORM LAGER_AN_PSP_VKBEL USING IT_VKBEL
                                             0
                                             PSPNR2
                                             H_MAKTX
                                             ' '.     "keine Blindbuchung
          ENDIF.
    ENDCASE.
    CASE SY-UCOMM.
        WHEN 'BACK_NEW'.
          PERFORM NEU_START USING 'X'.
        WHEN 'EXIT'.
          PERFORM NEU_START USING 'X'.
        WHEN 'CANC'.
          PERFORM NEU_START USING 'X'.
        WHEN 'CHECK'.
          PERFORM NEU_START USING SPACE.
    ENDCASE.
    Vasanth

  • Motion how to create 3d effect with a background and one primary object

    motion how to create 3d effect with a background and one primary object

    … like that?
    http://youtu.be/yOht1GJpEm4

  • How can I take photos with my iPhone and edit them on my iPad?

    how can I take photos with my iPhone and edit them on my iPad?

    Copy Photos Between iOS Devices
    http://tinyurl.com/cnz95bc
     Cheers, Tom

Maybe you are looking for

  • SAP SD BILLING

    Dear All, While creating Export Invoice I am getting the following Error. Posting keys for account determination for transaction EXD do not exist Message no. F5598 Diagnosis The posting keys necessary for account determination for transaction EXD hav

  • XSL Transformation breaks encoding declaration

    The first line in my XML: <?xml version="1.0" encoding="ISO-8859-1"?> The first line in my XSL: <?xml version="1.0" encoding="ISO-8859-1"?> Once I do the transformation, I end up with this in my XSL-FO file: <?xml version="1.0" encoding="ISO8859-1"?>

  • Aperture 2.0 Web Gallery - Broken?

    I am running Aperture 2.0 on a Mac Pro 2.8x8 10GB RAID0 OS 10.5.2 with all updates to graphics drivers etc. as of 02.17.08. I have a project with 43 photographs, in 6 stacks. 1. I select 3 photographs and click 'Web Gallery' button from Toolbar. 2. T

  • Re-install​ing win7 on a secondary drive.

    Dear all, I just ordered a T420s with a 160Gb SSD + a HD adapter 43N3412 + a 500Gb hard disk. I am planning to use mostly linux, and to keep win7 for games. Is there a standard procedure to erase win7 from the SSD and re-install it from the recovery

  • TS3212 errors occurred during installation

    errors occurred during installation.