Can Shape model a cross section of swiss cheese or a doughnut?

Can a GeneralPath or Area model a shape that has holes in the middle?
Could a GeneralPath model a 2-d cross-section of swiss cheese or a doughnut?
Do all the points of a GeneralPath need to be contiguous?
According Ernimril in [this post|http://forums.sun.com/thread.jspa?forumID=5&threadID=612402] , a GeneralPath can have a hole in the middle, as long as the winding rule is set to WIND_EVEN_ODD. This seems to be confirmed by [the explanation of WIND_EVEN_ODD on the documentation for GNU Classpath|http://developer.classpath.org/doc/java/awt/geom/GeneralPath.html] , and [this nice forum post explaining the difference between the two winding rules|http://forums.sun.com/thread.jspa?forumID=54&threadID=781529] . However none of the examples given point to a shape that consecutive but noncontiguous points.

Thanks for the tips! I've come up with an example that visually demonstrates that this can be done with GeneralPath or Area:
// ShapeTest1.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
class ShapeTest1 extends JComponent
    Area _shape;
    GeneralPath _generalPath;
    ShapeTest1( Dimension d )
        setPreferredSize( d );
        // using Area
        _shape = new Area(
            new Ellipse2D.Double(
                50, 50, 50, 50
        _shape.subtract(
            new Area(     
                new Rectangle2D.Double( 60, 60, 20, 20 )
        // using GeneralPath
        _generalPath = new GeneralPath( GeneralPath.WIND_EVEN_ODD );
        _generalPath.append(
                new Ellipse2D.Double( 150, 150, 100, 100 ), false
        _generalPath.append(
                new Ellipse2D.Double( 160, 160, 50, 50 ), false
    @Override
    protected void paintComponent( Graphics g )
        super.paintComponent( g );
        Graphics2D g2d = ( Graphics2D )g;
        g2d.setColor( Color.BLACK );
        g2d.draw( _shape );
        g2d.setColor( Color.RED );
        g2d.draw( _generalPath );
    public static void main( String[] args )
        JFrame frame = new JFrame( "ShapeTest.java" );
        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        ShapeTest1 shapeTest = new ShapeTest1( new Dimension( 300, 300 ) );
        frame.getContentPane().add( shapeTest );
        frame.setLocation( 100, 100 );
        frame.pack();
        frame.setVisible( true );
}

Similar Messages

  • Cross section view of 3D model in director

    Hello everyone
    I would like to know if it is possible to create cross
    section views (to define a cutting plane to be able to look inside
    the model) of a 3D model using Lingo . If so, can you give some
    insight on how to do it?
    Thks
    xnr

    > I would like to know if it is possible to create cross
    section views (to
    > define a cutting plane to be able to look inside the
    model) of a 3D model using
    > Lingo.
    This might also give you an interesting option:
    http://director-online.com/buildArticle.php?id=1104

  • How to make Geological Cross Sections in Adobe Illustrator?

    I have been tasked with producing a geological cross section in Adobe Illustrator. It is a lengthy process, as I am new to the software. I never learned it in my GIS studies. I know that there is plenty of GIS software out there to produce x sections automatically (we have Petrel for example), but they want it done in Adobe Illustrator as it's not a data driven x section.
    Does anyone have any familiarity with doing such a thing? I am having to basically use the cutting tool to divide up a box into the sedimentary layers. Then I fill the cut shapes with the correct colour. Complications arise, however:
    I have to show wavy lines between some sedimentary layers to indicate a gap, or layers which aren't shown. I am using the distortion tool to automatically produce the wavy line, which means I need to:
    a. copy/paste the original area
    b. change the appearance so there is no fill, delete all strokes except the one which will turn into the wavy line, apply distortion
    c. copy/paste the original area
    d. change the appearance so there is no fill, delete the stroke that will turn into the wavy line, change stroke to black line
    This means I have 3 elements whenever there is a part of the cross section showing a wavy line:
    the area which has a fill but no stroke,
    the wavy line (derived from the area by deleting the fill and strokes which aren't wavy),
    the rest of the stroke around the area.
    Does anyone know of a faster way to do such a thing?
    I wish I could just draw a shape using some sort of line tool and AI would detect when there is a closed off area so I could then select a colour fill.
    Another problem is the cutting tool does not make it easy to produce matching curves:
    In this image you can see that there is a wrinkle across many sedimentary layers, but my cutting skills in Illustrator mean that the lines do not follow a nice uniform shape. Of course this is the case in the real world as well, although at the moment the image has a bit too much of a 'hand drawn' look to it. Part of the problem is that the cutting tool, usually helpfully, smooths out the cut line as one goes (digitising a smooth curve with a mouse is impossible!). Sometimes this smoothing has undesired effects. It would be good to know if I can apply an offset to another line when cutting.
    Is it right that I should be using the cutting tool as my primary way of setting up a x section, anyway?
    I'm thinking a better way to do all of this would be to somehow have a tool that enables me to select vertices across multiple lines in sedimentary layers, then drag them up or down. This would then apply the same amount of curve across the layers.

    Once you've set up your Pattern Swatches, this should take only a few minutes:
    Draw your paths with a minimum of anchorPoints. Click (mousedown, mouseup) to place a corner point. ClickDrag (mousedown, drag, mouseup) to place a smooth point.
    The top and bottom paths are now identical. When used to define a Blend, the program interpolates the paths between. The anchorPoints of the two original "key" paths of the Blend can still be selected and manipulated while the Blend is live; and the interpolated steps update accordingly.
    t
    There are several Libraries of pre-built Pattern Swatches you can load. Or you can create your own if none of the provided ones are what you want. The help files will show you the basics of creating a Pattern Swatch. Create one for each different pattern you want in the strata. Select the rectangle and the paths. Get the Live Paint Tool. Set the current Fill to one of the Patterns. Click between two of the strata lines. The selected objects will be converted to a so-called LivePaint Group, and you can proceed to apply other Pattern Swatches to the various areas.
    The Shape Builder tool can then be used to trim away the outboard portions of the strata lines, back to where they intersect the rectangle.
    JET
    Strata

  • Cross Sections in 9

    Dear All,
    is it possible to have more then one cross section in a view?
    According to table 9.39 in the PDF Reference there may be an array of cross section dictionaries
    per view.
    Does it suggest that the feature is there but I just do not know how to use it or multiple cross sections are planed for but not implemented yet?
    BTW, there are two entries in cross section dictionary that Acrobat uses but I can not find documentation for: ST and PV.
    The first seems to make half of the model transparent instead of cutting it off.
    Sincerely, Michail

    The 3D annotation type in Acrobat and Adobe Reader only supports one active cross section plane at a time.

  • Data Model Layout (crossing lines)

    Hi Everybody,
    I downloaded the SQL Data Model and doing some modeling. It is doing a good job.
    How can I adjust the crossing lines in the diagram. I am not able to bend the relationship lines.
    Are there any hidden (undocumented) shortcut KEYS to do that?
    Where can I find those defined shortcut KEYS?
    Do we have an auto layout option to adjust the Entities and relationships in a page?
    Thanks in sharing your experience.

    Hi,
    you need to switch "Auto route" off and you'll be able to position manually the lines.
    Do we have an auto layout option to adjust the Entities and relationships in a page?There is limited "auto layout" functionality in relational model but it's not page oriented.
    Philip

  • Need some suggestion for Demantra Shape modeling

    Hi All
    Can any one sugesst me how to create a Demantra Shape modeling using 7.2 version. I am working on a POC which includes shape modeling.
    Thanks
    Ram

    Kim,
    Tttt yyyy pppp iii nnn gggg slowly.
    You described your situation quite clearly.
    As you probably know the digital inputs on the USB-6008/9 are software timed, so you have some uncertainty in the time of any sample.  Depending on your OS that uncertainty will typically be on the order of a few milliseconds but occasionally may be much longer.
    To count the pulses in software requires a combination of several things.
    1. You need to have a data acquisition method which is fast enough to capture each high and low state of the pulses produced by the pump.  For software timed Digital Input a good way to do this is to have an independent, parallel loop which reads the input line rapidly and passes the data or transitions to another loop via a queue.  This is known as the Producer loop in a Producer/Consumer architecture.  Examples come with labVIEW. A 10 ms Wait in the loop is probably appropriate.
    2. You need to convert the digital inputs (levels) into pulses or transitions to be counted.  Suppose you want to increase the count by one every time the logical level changes from False to True. To do this you need to know the previous level and the current level. A shift register is one of the best ways to do this in LV.  Add a shift register to the loop.  Initialize it to False. Connect the result of the Digital Read to the right terminal of the shift regsiter inside the loop.  When that Read is True and the previous value (obtained from the left terminal of the shift register) is False, increment the count value (which is also kept in a shift register) in the case structure.
    3. You did not indicate what you are doing with the counts or what the pulses represent.  Do you need to measure the frequency (or the period which is the reciprocal of the frequency)?  Do you need to accumulate the number of pulses? Over what time period?
    Lynn

  • How can I change the itunes store from Swiss to the Italian one on my ipad2 with new software ios6? Thanks

    How can I change the itunes store from Swiss to the Italian one on my ipad2 with new software ios6? Thanks

    See More Like This to the right of this post!

  • How can I set a cross reference to a Picture

    Hello,
    I have a question regarding the new function: How can I set a cross reference (dont know the exact english name since I use the German version; in German: Querverweis) in Indesign CS4 to a picture? So far, I could only do it with a kind of workaround by putting an invisible text frame above or below the picture and referencing to that one.
    Any suggestions?
    Tschens

    Or put it inside a text frame as an inline graphic. You've basically figured it out.
    Peter

  • My apple tv main menu no longer displays the "movies" section, just internet, computers, and settings. Does anyone know why or how to get it back up? Recently rented a movie directly through apple tv but can't see the movies section in main menu now.

    My apple tv main menu no longer displays the "movies" section, just internet, computers, and settings. Does anyone know why or how to get it to show again? Recently rented a movie directly through apple tv but can't see the "movies" section in main menu now. WiFi and home sharing are working.

    Welcome to the Apple Community.
    Check the location setting for the iTunes Store is correct.
    You might also try restarting the Apple TV by removing ALL the cables for 30 seconds.
    Restart your router.
    If you are still having problems try a restore.

  • How can I set up cross fade to automatically trim files ?

    How can I set up cross fade to automatically trim the two files to size when fading between them? Thanks

    Hi, thanks for the reply. What I meant was that in Pro Tools, you can highlight an area between two tracks and crossfade. Then the files are exactly trimmed automatically so there is no excess overlap of the edges of both files. In Logic it seems to leave the overlap, and this can be a problem when you accidently click the wrong place and the underlying file is bought to the front, changing the crossfade area. I wish it to trim the excess so there is no danger of the lower file edges coming forward.

  • Cross-section option sometimes missing on 3D PDFs

    I publish 3D PDFs of complex mechanisms for my subscribers. Sometimes Adobe Reader will offer a cross-section option and sometimes not. The 3D PDFx are not made by Acrobat Pro but with an embedded PDF generator inside my mechanical CAD software. I don't make any changes in the way PDFs are generated by the program.
    Any ideas?

    Good questions. - in addition which version of Acrobat is it, and for Windows or Mac?. I tried a few combinations of making single and multiple cross section with face and non-cross section views on a few files in Acrobat 11 on Windows, and could not see any problem.

  • Database files can be ported over cross different OS ?

    Can someone highlight me:
    "under oracle version 10 release 2, database files can be ported over cross different OS, e.g. between HP-UX and Sun Solaris", --- is it true ???
    thanks in advance.

    check out the CONVERT option available with RMAN of Oracle 10g.
    for details look at the 10g Recovery Manager Reference.
    Only restriction is both the source and the target should have a compatible parameter in the init.ora file set to 10.0 and higher.

  • How can i Change the currency symbols for swiss francs?

    Hi,
    i use Numbers '09.
    How can i change the  currency symbol for swiss franks from SFr to CHF. Because the international ISO abbreviation is CHF and not SFr.
    Thanks,
    Bye

    Switch to Lion.
    I checked several currencies and now they are OK.
    Yvan KOENIG (VALLAURIS, France) samedi 8 octobre 2011 23:24:26
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • Why I can't set the Detail Section of a form at onLoad event?

    Hi,
    I'm having a silly problem with Access 2010. I can't modify the Detail section ("Corpo" in Italian) of a Form or a Report.
    Neither using the onLoad nor the onOpen events.
    What am I doing wrong? I load a micro example in my
    one drive, if you would spend some time helping me.
    Thanks in advance, Lauro

    Hi,
    I'm having a silly problem with Access 2010. I can't modify the Detail section ("Corpo" in Italian) of a Form or a Report.
    Neither using the onLoad nor the onOpen events.
    What am I doing wrong? I load a micro example in my
    one drive, if you would spend some time helping me.
    Thanks in advance, Lauro
    You should be able to size the detail section of the Form in the open event or onload event.
    I don't have 2010 on my PC. Why not post the sample code here?

  • Hello!  I need Apple (!!!) headphones for Ipod Shuffle 3! (only apple earphones with remote and mic!!!) Tell me, what distinguishes the model are presented in black and white boxes? They may differ in features? Can one model is more modern than the other?

    Hello!
    I need Apple (!!!) headphones for Ipod Shuffle 3! (only apple earphones with remote and mic!!!)
    Tell me, what distinguishes the model are presented in black and white boxes? They may differ in features? Can one model is more modern than the other?
    Thanks in advance!

    Hi Fencer1986,
    I apologize, I'm a bit unclear on your request. If you have questions about headphone compatibility for your iPod shuffle 3rd Gen, you may find the following article helpful:
    iPod shuffle (3rd generation): About headphone compatibility
    http://support.apple.com/kb/ht3472
    Regards,
    - Brenden

Maybe you are looking for

  • Transfer from iPod to Computer

    I returned my old computer before saving the library to my iPod. I did however export the library, so I have it on my new computer hard drive. Is there anyway I can import it to the library on my new computer so it will reflect my iPod? If not, what

  • Wait stats analysis help

    I personally prefer Activity Monitor, Server Standard Reports & Database Standard Reports, however, I keep seeing frightening DMV queries which I don't know how to interpret, in fact, I am not even convinced that the queries are correctly formulated.

  • Audition CS6 Crashing On Start-Up

    I have used Audition CS6 several times on my Windows 7 64-bit system in the 3 weeks I have had it installed, and have used it without problems. But, after using Audition CS6 early today, I tried to start it up this afternoon and got the following mes

  • Inkjet CP1700D Printer

    Several weeks ago, my Inkjet Printer CP 1700D displayed a message to replace all four print heads. I cleaned them, and after one sheet printed, got the same message again. I then ordered from HP the four print heads, installed same, and until today,

  • Problems with iChat audio and video with Airport extreme

    I am trying to use iChat video and audio between a Macbook Pro and macbook running 10.5.4 through airport extreme. When we attempt to do this it constantly says the other person has declined or hangs. I have also tried to contact people overseas and