Much of Melancholia is structured similarly to Dogville, making its audience endure the tedium of von Trier's miserabilism for the inevitable big bang pay off. In Dogville, it was the heroine slaughtering an entire town for the various ways the citizens raped her in the previous two hours of screen time, but here it's literally the cataclysm of two worlds colliding -- that, I should note, makes the best use of low end frequencies in any film I've ever heard. (In the director's oeuvre, women have participated in the destruction of their own bodies, their family, their neighbors and now their entire civilization -- where will his heroines go from here?) This isn't a spoiler, since von Trier gives away the plot in the apocalyptic précis that constitutes the first 10 minutes or so of the film. Filmed in an ominously metaphysical slow-motion, this phantasmagoria is surely the best part of the film and a visual allusion to doleful Justine's ultimate fantasy. The film could only go down hill from there as it fills in her dreamy ellipses with the mundane drama that's the majority of the two acts that follow.
In the first act, we see Justine's melancholia destroy her new marriage during the wedding festivities. In "Melancholy and the Act," Slavoj Žižek argues melancholia is a pathological identification with a lost object that's being mourned before it's even lost. Because the identification is fundamentally narcissistic, about what Justine lacks, her husband (the object) can never fulfill what was the cause of the desire, namely a desire for her own desire itself. That is, melancholy "stands for the presence of the object itself deprived of the desire for itself -- [it] occurs when we finally get the desired object, but are disappointed with it." [p. 148, Did Somebody Say Totalitarianism?] Once acquired, the husband loses his ability to fill the void -- to short-circuit the desiring feedback loop -- in Justine's life, so she loses her desire for him (which was actually lacking in the first place). She mourns having lost him before he finally gives up and leaves her.
By mirroring domestic drama in a cosmological transformation, Melancholia provides a much commented upon thematic connection to Terrence Malick's Tree of Life. More importantly, it seems von Trier's film shares Malick's Heideggerian concern (the influence of Martin Heidegger is discussed here, regarding Tree of Life, and here, regarding Thin Red Line). In his final two acts, von Trier (unsurprisingly) sides with Justine's depression against her sister's seemingly better-adjusted family with whom she's come to stay while the planet Melancholia moves ever closer to Earth. At first, Claire and her husband John take care of Justine: the sister bathes, feeds and encourages her to get out of bed while the husband provides the scientific analysis proving that Melancholia won't crash into them. Claire's sense of well-being is revealed to be a fraud, hiding behind the ratiocination of John's math: when Melancholia's unpredicted course proves him mistaken, the only one prepared for Earth's destruction is Justine.
This provides another way of looking at melancholia, as existentialist Angst, what Heidegger considered an authentic attitude towards Being itself by being-towards-death. By making nature seem controllable, reducing it to instrumentality -- what Heidegger called Enframing -- science and technology separate us (beings as such, living our lives) from Being itself (the ultimate basis of reflection), making Dasein (being-there) inauthentic. I have trouble with mystical-sounding jargon, but I hope my point will be clear: through Enframing, things become detached from their thingness (otherness), become objects for our control and manipulation -- as Malick might say, Nature loses its grace for us (Tree of Life reveals our everyday lives' connection to Nature). John rids Claire of any fear of the coming apocalypse by making the wayward planet out to be something under his control. In this way, John's approach to the planet is the same narcissistic identification as Justine's desire for her husband. When his calculations are proven wrong, he loses what he never had to begin with, control with its objective correlative being the planet Melancholia. spoiler warning! Thrown back into the world, he commits suicide. end spoiler. The buffer (short-circuit) having failed, his depression is the real (pathological) melancholia, since he's never authentically engaged his finitude (being-towards-death). Justine has been prepping her whole life for the end, and is now able to help her sister and nephew to calmly face their extinction. Unlike Malick, there's a irony here in that it takes the end of the world to confirm the philosophy.